the_post_thumbnail ('something')
-
Hi
I am using a customized template which uses the function
the_post_thumbnail ('something')to get the thumbnail for the posts. This thumbnail is supposed to be defined in the post in the backend, but it is not. Instead, there is another featured image. I found the image displayed in some folder, but its name is not ‘something’, it’s ‘whatever’. I would like to know how I can change the code in order to display ‘whatever2’ as ‘something’.Thank you
-
You do know that
somethingis supposed to be a particular image size – not a specific image from your Media Library, yes?and where is it defined? because
somethingis not similar to 250×250 but to “Hello”.Here it is said that
add_image_size()add an image size, but neither ‘something’ nor ‘whatever’ appears.I can’t find it…
I’m sorry but I am really not following you. Neither
add_image_size()northe_post_thumbnail()take a file name as a parameter.I’m sorry but it does, as stated in:
http://codex.wordpress.org/Function_Reference/the_post_thumbnailin the Thumbnail Sizes section.
And I can assure you my website does use it, and it changes if I’m using
the_post_thumbnail()orthe_post_thumbnail('something').And what is
something? Can you provide specific and not just generic examples?it changes if I’m using
the_post_thumbnail() or the_post_thumbnail(‘something’).can you post a link to your site, where you use both codes within one template, to illustrate the different output?
what theme are you working with?
if the (original) theme is not from http://wordpress.org/themes/, have you contacted the developer of the theme for support?
I have a news template, which contains the text:
<div class="span4"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('news1'); ?></a></div>I can’t find “news1” anywhere (I did not program it).
The code above is supposedly displaying information of a post created in the backend, lets say post1. This post1 contains one featured image, which is not news1.
However, inspecting the code of the website, this
<?php the_post_thumbnail('news1'); ?>displays an image from a folder, image called “The-first-news.jpg”, which is a completely different name.So I want to display another image instead of “The-first-news”, but I can’t understand the code or find where the link between news1 and The-first-news is set.
Where did you download this theme from?
alchymyth, it’s a customized theme, and I did not contact the developer by now.
If i usethe_post_thumbnail()I get the featured image upload in the post in the back end.
If i usethe_post_thumbnail('something'), I get a different image, which is not uploaded in the post featured images.<?php the_post_thumbnail('news1'); ?>is referring to a specific image size defined (presumably) in the theme’s functions.php file usingadd_image_size(). It is not referring to a specific image as far as I can tell.I can’t find “news1” anywhere
if the corresponding thumbnail size is not defined in your theme, then the default size will get used.
to repeat:
the argument of thethe_post_thumbnail()function does not refer to a file name.please make yourself familiar with http://codex.wordpress.org/Post_Thumbnails
the ‘featured images’ aka post thumbnails of a post or page are set when editing the post or page;
http://codex.wordpress.org/Post_Thumbnails#Setting_a_Post_ThumbnailSo,
1. news1 should be defined in the functions file, which is not. I got 5
add_image_size();code lines, and none of them is for news1.2. the image displayed size is 280×250, which is a different size from all
add_image_size();defined in the functions file3. my media settings in the backend are:
thumbnail size: 150×150
medium size: 300×300
large size: 1024×1024.So where is ‘news1’ defined?
You need to ask the theme’s developer that question. As this is a custom theme, we can’t really help a great deal.
The topic ‘the_post_thumbnail ('something')’ is closed to new replies.