WordPress.org

Ready to get started?Download WordPress

Forums

my flatonica
Featured Images Carryover Into Single Posts (3 posts)

  1. Shapeshifter 3
    Member
    Posted 11 months ago #

    Arf! Arf! Arf!

    I decided to try this theme because it's based on Bootstrap. What I've noticed is that Featured Images display on both the Blog Page and the individual single posts themselves. This results in two images displaying on smart phones for each post (the Featured Image itself, and the first image on any embedded video). How come? I didn't think it was supposed to be that way. Here's an example on my own site:

    http://toolbox-4-websites.com/category/music-videos/

    I've noticed the exact same problem on numerous themes in the Themes Directory (INCLUDING the latest themes provided by Automattic on WordPress.org). It can't be a Bootstrap problem, since the Customizr Theme and other Bootstrap themes don't seem to have that problem.

    Is there a snippet of WordPress Core Code that I can Cut & Paste into my theme to get rid of the problem....why does it keep showing up over and over with different WordPress Themes? Is it an intentional effort on the part of some theme designers?

  2. Shapeshifter 3
    Member
    Posted 10 months ago #

    Arf! Arf! Arf!

    OK, I've figured out how to do it with this particular Bootstrap theme:

    1. Placed a copy of the parent theme's Single Post (single.php) file into my child theme.

    2. Deleted this portion of the (single.php) file from the child theme:

    <?php if( has_post_thumbnail() ){ ?>
                                    <div class="my-thumbnail">
                                        <?php echo get_the_post_thumbnail( $post -> ID , array( 9999 , 9999 ) , esc_attr( $post -> post_title ) ); ?>
                                        <?php $caption = get_post( get_post_thumbnail_id() ) -> post_excerpt; ?>
                                        <?php
                                            if( !empty( $caption ) ) {
                                        ?>
                                                <footer class="wp-caption">
                                                    <?php echo $caption; ?>
                                                </footer>
                                        <?php
                                            }
                                        ?>
                                    </div>
                                <?php } ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    I don't know if I deleted too much or not. So far, it's working great! Here's the same link to one of my blog categories (a click on any of the posts shows no image carryover):

    http://toolbox-4-websites.com/category/music-videos/

  3. Shapeshifter 3
    Member
    Posted 10 months ago #

    Oops!

    I forgot to enclose the above code, so here it is again:

    <?php if( has_post_thumbnail() ){ ?>
                                    <div class="my-thumbnail">
                                        <?php echo get_the_post_thumbnail( $post -> ID , array( 9999 , 9999 ) , esc_attr( $post -> post_title ) ); ?>
                                        <?php $caption = get_post( get_post_thumbnail_id() ) -> post_excerpt; ?>
                                        <?php
                                            if( !empty( $caption ) ) {
                                        ?>
                                                <footer class="wp-caption">
                                                    <?php echo $caption; ?>
                                                </footer>
                                        <?php
                                            }
                                        ?>
                                    </div>
                                <?php } ?>

Reply

You must log in to post.

About this Theme

About this Topic