• Resolved lunarius

    (@lunarius)


    Hello,

    I’ve been peering at the code and trying to figure how how to make a sort of mashup between the single and two-column display methods so that I can have the overall view of the single column while keeping the Featured Images that only seem to be displayed on the two-column display.

    If someone could point me in the right direction on the matter I’d be very appreciative.

    Thanks much!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Do you have a child theme set up? That would be the best way to make changes that won’t be overwritten when you update the theme.

    The file content-single.php is where the single column layout is defined.

    Try placing a copy of content-single.php in your child theme folder. You can then edit this file to try displaying the featured image there, wherever you want it placed – perhaps before <?php the_content(); ?>

    This is the function to display the featured post:

    https://codex.www.ads-software.com/Function_Reference/the_post_thumbnail

    Hope that gets you off to a good start – let me know how it goes!

    Thread Starter lunarius

    (@lunarius)

    Hello!

    Yes, I do; I apologize for not mentioning that from the outset.

    I’m finding that when I make edits to the copy of content-single.php with the child theme active that these edits don’t actually show up at all. I’ve used both

    <?php if ( has_post_thumbnail()) : ?>
       <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       <?php the_post_thumbnail('large'); ?>
       </a>

    and code for the thumbnail lifted directly from the content-two-col.php file.

    I’ve even taken chunks of content out and it makes no difference. The child theme is active; I’ve been checking and double checking that, but it doesn’t seem to make any impact.

    I’ve tried it across browsers to rule out any pesky cache issues (though I did clear the cache first to be sure such a step was necessary).

    I’m really not at all sure what to do next; I’m sorry not to report good news!

    Hi there – is this the site in question? https://art.lunarius.net/

    Just to confirm, have you selected the single-column layout under Appearance > Theme Options?

    Theme Options Test Site WordPress

    Could you hard-code some text into the content-single.php file, say try adding this:

    <h1>Hi there!</h1>

    …just before this:

    <?php the_content(); ?>

    Thread Starter lunarius

    (@lunarius)

    Hello!

    Yes, that is the site. I was hesitant to post it since I didn’t know if it was necessary and I didn’t want to spam.

    Yes, I have indeed. https://dl.dropboxusercontent.com/u/88630699/sunchild_theme_op.png

    Done. It has been added and I’ve left it in place. On my end I’m seeing no sign of change at all.

    Thank you, again, for helping me with this. I’m positive this is going to come down to a silly error on my end and while I hope I don’t waste both our time, I want to make sure to thank you profusely just in case.

    Thanks! So it does look like the content-single template is being applied:

    https://art.lunarius.net/?p=339

    Do you see the Hi there! text between the image and post content?

    For example:

    https://art.lunarius.net/?p=330

    Screenshot: https://cloudup.com/cNIj2NH3Luq

    So it looks like you have the featured image, followed by the hard-coded “Hi there!” followed by the post itself.

    Let me know if you see something different that that, or if you’re trying to accomplish something else, can you explain it in more detail. Thanks!

    Thread Starter lunarius

    (@lunarius)

    I think we’re on the same page but different paragraphs, Kathryn. I’m trying to get the front page to show the image, not the individual post pages. That’s totally my fault–I could have, and should have, been far clearer.

    If you look at https://art.lunarius.net, there’s no featured image and no “Hi there!” text to be found. https://dl.dropboxusercontent.com/u/88630699/havewant.jpg

    Is there some way to do that?

    Ah, my apologies for misunderstanding!

    The blog page is generated from the index.php file.

    Within that file, this line calls in the file content.php:

    get_template_part( 'content', get_post_format() );

    This means that you can edit the file content.php (that’s what ‘content’ refers to) to display your featured images.

    Try adding this:

    <?php
       if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail
       the_post_thumbnail('medium');
       }
    ?>

    …where you would like the featured image displayed, for example just after line 31:

    <div class="entry-content">

    You can also use a different size than medium if you’d like the featured images smaller or larger.

    I just tested this and it works on my end.

    Let me know how it goes!

    Thread Starter lunarius

    (@lunarius)

    No need to apologize at all!

    It works -perfectly-!

    Thank you so very much for your patience and your very clear, concise explanations. After some tinkering with alignment I’ve got it settled where I like it for the time being and it looks pretty exactly how I wanted it to.

    Thank you, thank you, thank you!

    Oh, wonderful – glad to hear you got the effect you’re after.

    Glad to be of help, enjoy the theme!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Show 'Featured Image' on Single Column display?’ is closed to new replies.