How to avoid images from wordpress page? - wordpress

I have inserted an image in wordpress theme header.And now the image shows in all wordpress pages.I want to avoid that please help me.

Well, in that case you can use the conditional tag, For example, if you want to display the image in only contact page, then u can use this code: if(is_page( 'Contact' )) { Put your image code here } where Contact is the title of that page
Hope it helps.

Related

Why is a line break (<br />) being added to my image URL?

My website is built on WordPress and using the theme Divi. I am writing a new post and using the Divi image module to add images. In the editor the image shows up fine, however when the post is previewed or published, the image doesn't show up. Upon inspection, the URL for the image has a <br /> in it which is breaking the link to the image.
Any idea why this is happening? Thanks in advance.
Are you putting your image directly with the text editor or a you writing your text separatly ? With divi's page builder you can add an image to a block or widget, and write the text inside separatly.
I also have the same issue - Divi image module - generates a wrong path of image src.
I also have no solution, but I built a work around until the cause is found and have concrete solution.
function change_url_the_content($content){
$content = preg_replace("/br\%20\//", "", $content );
return $content;
}
add_filter("the_content", 'change_url_the_content', 9999999);

NEED HELP - how to make an excerpt of the post clickable?

I am working in Wordpress, and I am using Elementor. Elementor has a native feature for the title of the posts and images to link to the post.
But if I add an excerpt text, it doesn't link to the post. It is not clickable. The read more button does, but not the excerpt of the post.
I am trying to create something like this: greatist.com Every post on their website is clickable - the excerpt, the title, and the image.
My excerpts are really short like on that website, and I would really like them to be clickable. I have absolutely no idea how to do this and I'm beginning to think it's not possible. I am using Hello Elementor theme.
I would deeply appreciate anyone's help. I just registered to ask this question.
You can always try to save text as an photo and make it clickable or make a full section clickable.To do this try to use plugin called "Make Column Clickable Elementor".
Add this code to your website:
const postExcerpts = document.querySelectorAll('.elementor-posts .elementor-post .elementor-post__excerpt');
postExcerpts.forEach(postExcerpt => {
const postUrl = postExcerpt.parentNode.querySelector('.elementor-post__title a').href;
postExcerpt.addEventListener('click', () => {
window.location.href = postUrl;
});
});
This can be added using a script tag. Choose from the following options:
Add this code as a script tag in your functions.php file, to be rendered at the end of the page (wp_footer action hook).
If you have Elementor Pro, use its built-in Custom Code feature to add the code in a script tag to the end of the body tag.
It's recommended to add a pointer cursor so the user will know the excerpt is a link. This can be achieved by adding the following CSS to your style.css file.
.elementor-posts .elementor-post .elementor-post__excerpt {
cursor: pointer;
}

How to make a wordpress image header appear only on homepage?

How do I make my image header only appear on my homepage? Also, how do I edit code in WordPress to fix this?
You can use this wordpress function is_front_page() to for this kind of thing, Simply add if condition
if(is_front_page()) {
/*your header image goes here and you condition*/
}
You have multiple ways for doing this either you can use header.php or you can make a home page template and write this condition this your home page template.

The URL added while adding featured image in wordpress

I am working with wordpress latest version.
As in wordrpess, we can add URL while adding a featured image in a post as there are text fields like caption, title, alt text, description, URL etc.
I've added a link like http://example.com/abc-news
I am fine to show the featured image in the blog post but I want that link as
{featured-image}
So that, if anyone clicks on the featured image he/she will go to that link.
Any help would be appreciated.
If you are using the default theme with the latest version of WordPress, you can edit content.php in the 2014 theme directory.
You need to wrap <?php twentyfourteen_post_thumbnail(); ?> with the link code pointing to your URL.
This code should be around line 13 in content.php.
<?php twentyfourteen_post_thumbnail(); ?>
To link to the current blog post, you could add this code:
<?php twentyfourteen_post_thumbnail(); ?>
If you are using a different theme than the default, open the file which contains The Loop in your theme, search for the_post_thumbnail or a similarly named function, and change the code as above.
The exact answer will vary depending on theme, but 98% of the time the fix should be similar to the above. Hope this helps.
Edit: Here's some more information: http://codex.wordpress.org/Function_Reference/the_post_thumbnail#Post_Thumbnail_Linking_to_the_Post_Permalink
Thanks for your prompt reply.
You are right that it's 98% depending on the theme.
The theme is using a meta_value to add a custom URL for the featured image.
So, I need to get that URL through get_post_meta
I've got from here.
And I am fine with it now. :-)
Thanks

Nextgen wordpress plugin: url to gallery tag

I developed a plugin that appear people information and in the end of this I put some pictures. Well, I want to put one link to gallery tag, but I don't know how can I do it
For the gallery I use this function: nggShowRelatedGallery($tag, 10); and I want to use $tag var in the link. For example, if I put: http://www.web.com/gallery/tag/cars I would like that appear all photos of "cars" tag.
Anybody can help me?
Thanks U :)
Take a look at the rewrite Api.
It will get you far.

Resources