Displaying post featured image before the title

Community Forums Forums General Discussion Displaying post featured image before the title

This topic is: resolved

This topic contains 4 replies, has 3 voices, and was last updated by  blustemy 1 year, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #64451

    blustemy
    Participant
    Post count: 5

    Hi,

    I would like to know how to display the featured image of a post just before its title, for every post.

    Actually I’ve tried something as simple as this, just displaying a static text instead of the image, in the file functions.php of my child theme:

    add_action( 'genesis_before_post_title', 'insert_test' );
    function insert_test() {
    	?>
    		<h1>test</h1>
    	<?php
    }

    But nothing appears! I’m a bit lost…

    If anyone has clues on this issue that would be great.

    Thanks a lot.

    #64466

    Susan
    Moderator
    Post count: 9426

    Try this code snippet from:

    http://wpspeak.com/customize-featured-image/

    [php]
    // Move image above post title in Genesis Framework
    remove_action( ‘genesis_post_content’, ‘genesis_do_post_image’ );
    add_action( ‘genesis_before_post_title’, ‘genesis_do_post_image’ );
    [/php]


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #64472

    blustemy
    Participant
    Post count: 5

    In fact it seems the hook add_action( 'genesis_before_post_title', 'insert_test' ); works only when I remove HTML5 support.

    So, I’ve found a fix:

    add_action( 'genesis_entry_header', 'insert_test', 1 );
    function insert_test() {
    	?>
    		<!-- I’ll put the code to display the featured image here -->
    	<?php
    }

    I haven’t found any official documentation on this. Only Googling…

    Anyway, thanks a lot for your help.

    #64536

    braddalton
    Participant
    Post count: 10577
    #65356

    blustemy
    Participant
    Post count: 5

    Thanks a lot, this visual hook guide is awesome. It really helped me understand all the available hooks!

    It resolved my initial issue :)

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

You must be logged in to reply to this topic.