Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   [SOLVED] Hiding the featured image from specific posts (http://forum.bytesforall.com/showthread.php?t=20477)

emanuel1969 Jun 9, 2013 04:11 PM

[SOLVED] Hiding the featured image from specific posts
 
Hi everyone,

I would like to hide the featured image on specific posts. My idea is to create a custom field (hide_featured_image") and set its value to "yes". Then use some php code like the following:

-----
$shouldHideFeaturedImage = get_post_meta($post->ID, 'hide_featured_image', true);

if ( $shouldHideFeaturedImage != 'yes' ) {
if ( has_post_thumbnail() ) {
the_post_thumbnail('medium');
}
}
-----
Am I on the right track here? And where would I put this code? People told me I should look for the single.php file but I can't find it.

Thanks!
Emanuel

lmilesw Jun 9, 2013 06:13 PM

How about just using CSS targeted to those specific pages and featured images?

emanuel1969 Jun 9, 2013 07:15 PM

The problem with that is that it is a daily news site, and there are many content contributors. I need them all to be able to choose whether the featured image displays inside the post or not.

juggledad Jun 9, 2013 07:35 PM

You will need to make some changes in bfa_post_parts.php arond line 149 (v 3.7.12)

emanuel1969 Jun 9, 2013 07:51 PM

Actually Juggledad, that affects the display of the thumbnail on multi-post pages. What I am wanting to do is remove the featured image from select "single-post" pages.

emanuel1969 Jun 9, 2013 08:03 PM

OMG never mind! I'm the one who added a widget area to the single post pages then used a php-enabled text widget in order to display the featured image there to begin with!!!

It was just so long ago I forgot. :)

I thought the featured image was showing up on single post pages automatically.

Problem solved. Thanks!

juggledad Jun 9, 2013 08:19 PM

Featured images are for multi post pages. And if you don't want the featured image why not remove it from the post edit page?

emanuel1969 Jun 9, 2013 09:43 PM

It's complicated. We use featured images everywhere in our multipost pages. But we also wanted the featured image to appear at the top of single-post pages too, in a large format. So I programmed some php to make this happen and put it in a text widget that I made appear at the top of each post using a plugin called "widgets in posts" (or something like that).

But they I discovered that there are some posts we do NOT want the featured image to appear at the top. These are essentially posts that are only embedded videos.

Why all this matters is hard to explain, but if you look at the site you can get an idea of how complex it is. This is a daily news site with a number of post contributors. To make all the news articles standardized, I made it so the featured image was also the main article image at the top of the single-post page. This means the contributor does not have to embed an image into the article if they do not know how to do that. It also automatically standardizes the size of the image so they don't have to adjust it.

It's working perfectly. Check it out. It's really my best site ever:

http://www.popularresistance.org

Emanuel

emanuel1969 Jun 9, 2013 09:45 PM

To make a long story short, there are a lot of people who add content to this site, and I had to make it stupid-simple for them to avoid constant mistakes happening.


All times are GMT -6. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.