Use standard post picture and title format instead of background image?

Home Forums Forstron Use standard post picture and title format instead of background image?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16557

    saardvark
    Participant

    Use standard post picture and title format instead of background image?

    Resolved

    Hi there,
    I very much like the forstron template. I am trying to make the single post page a little more “standard” however and can’t figure it out. Rather than have the featured image as a background with the title overlay, I would like to have the image in a DIV tag beneath the title and meta data — where I can then control it a little via CSS.

    In the URL below, that would be just above the first paragraph of content. I looked at the content.php file and the various setup files and hooks and just don’t know enough to figure it out.

    Anyone else have this solved?

    #16569

    Oliver Juhas
    Keymaster

    Hi saardvark,

    Thank you, I’m glad you like the theme :)

    I see you have successfully hidden the post intro section already with CSS. So, here is the PHP code you need to use in your child theme‘s functions.php file to display the post featured image at the place:

    /**
     * Display post featured image in "Medium" size
     */
    function child_theme_post_featured_image() {
    	if ( is_singular( array( 'post' ) ) ) {
    		echo '<div class="entry-media">';
    		the_post_thumbnail( 'medium' );
    		echo '</div>';
    	}
    }
    
    add_action( 'wmhook_entry_top', 'child_theme_post_featured_image', 30 );
    

    Best regards,

    Oliver Juhas
    WebMan Design

    • This reply was modified 10 months, 1 week ago by  Oliver Juhas. Reason: Fixing `is_sungular` to `is_singular` in the code provided
    #16634

    saardvark
    Participant

    Hiya,
    Thanks so much for the response. Unfortunately adding that code seems to break the site. I tried adding it in various places to make sure that wasn’t the issue. The result was that the “wp admin bar” disappeared, the main menu showed up and then no content below that (if that helps at all)

    Anything you see in the code that doesn’t seem correct? I removed it from the functions.php file again btw.

    I really appreciate that you respond to people who are trying things outside the scope of their talents and what is reasonable support by the way. Five stars for sure.

    #16636

    Oliver Juhas
    Keymaster

    Hi,

    Indeed, you are correct. I’m really sorry, I’ve made a typo in the code provided. I went ahead and fixed is_sungular for is_singular. That should fix the issue.

    For the future, to determine what is wrong with your WordPress, you can put it into a debug mode.

    Regards,

    Oliver

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.