phpwordpressimagewordpress-featured-image

Remove the featured image from the top of each post


I am trying to remove the featured image from the top of each post. I am using the Pure theme from gt3 themes. The featured image shows up at the top and shoves all the other content to the far right.

I have tried installing the remove featured image plugin, while the tickbox shows up clicking it has no effect. I have also tried editing the page.php and single.php pages within the theme as suggested by several other posts. But the lines they call to be removed are not present in my code (or at least I have not located them). The only code I am seeing (inside singel.php) related to the featured image/thumbnail is:

$featured_image = 
wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'single-post-thumbnail'); 

I have tried removing this with no effect. I have also tried adding something like this to the css

.featured_image_standalone {
display:none;
}

Also no effect. I have a few clients that use the Avada plugin and I have managed to disable the 1st featured image with no problem but I am hoping for a free alternative to purchasing this plugin.

Alternatively, I would be satisfied if I can add additional images below the featured image, leaving the copy to the right. Like on this demo page.

Any help is greatly appreciated! I am a beginner but have been editing/managing WP sites for clients for several months now so I've gotten my hands dirty and with a little instruction I am sure I can remedy this issue.

Thanks!

PS. I tried adding links where appropriate but it appears I can only add 2 in the forum so please ask for clarification and I will post.


Solution

  • It's possible that you're viewing the pages that use template other than page.php.

    I'd do the changes to the other template files (in the theme root directory). Also the templates that are dedicated for posts instead of pages.

    Commenting that line might lead to an error of calling an undefined variable and/or assign an alternative default value if it isn't defined. So I'd initially experiment with a specific hardcoded thumbnail id like this:

    $featured_image = 
    wp_get_attachment_image_src(
        get_post_thumbnail_id( 123 ),
       'single-post-thumbnail'
    ); 
    

    '123' being the test id that you're using.

    In some environments when PHP gets a fatal error, the server continues to serve the last executable version of the files, hence you might be not witnessing the change because of the fatal error.


    Edit

    Based on the image that lists the files of the theme provided in the comments, I'd copy the following files, one at a time, to the child theme directory and modify the code there:

    The previous list is ordered by likeliness of the file to be the one you'd want to update, so I'd try one at a time and see the results. Also you'll need to copy these files to the child theme because any modifications to the original files under the parent theme can be erased upon theme upgrade.

    To find post ID you can check wp_posts table in phpMyAdmin, if that's not accessible, before anything you can do echo 'post_ID: ' . get_the_ID(); in one of the template files and visit a particular page to see the echo'd ID. Also I think there are some plugins that display the post ID's at the post table withing the admin dashboard UI.

    In order to see whether the server serve the last executable files upon fatal error, you can make an echo statement and with every code change to see if the echo get printed.