Swap the Position of Featured Image and Title in Genesis Framework

There is no doubt that using framework like Genesis or Thesis is hard at first because there is learning curve. Besides the standard WordPress hooks, filters etc, you need to learn tons of specific hooks, filters etc for those frameworks.

However, once you’re good at it, you’ll definitely never look back. Trust me, those hooks, filters etc really help you to cut of the development time.

By default, in Genesis, the post title appears before the featured image. Here’s a snippet to change and swap the position of image and title in the loop.

1 2 3 4 5
<?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' );
view raw functions.php hosted with ❤ by GitHub

Paste the code above in your functionality plugin or theme’s functions.php file.

Please note that this only works if you’re using the default loop.

Comments

  1. Wonkie says

    Hi… we’re in the process of moving our comic blog to Genesis - you’re right about the learning curve - for non-techies like us it’s proving to be quite a challenge! I’m curious to know, on a single post page, is it possible to display the featured image first and under that the post title and content (as you have it above) BUT also have the sidebar only start after the featured image is displayed.

    The problem we’re having is that the cartoon image spans the entire width of the theme (which we don’t want to change) - so if it displays as a regular featured image, the right part of the image gets covered by the sidebar! Any help or suggestions would be much, much appreciated! Thanks :)

    • Editor says

      Hi Wonkie,

      First of all, welcome to Genesis Community :)

      Yes, it is possible. You’ve to know to use the right hook to “hook” it in that position and create a function for the featured image.

      If you want to use my service, feel free to contact me. This kind of customization approximately will only takes less than an hour.

  2. Dominic says

    Hi there,

    Great tutorial. You mention this only works for the default genesis loop - If I’m calling a specific category via a custom loop on my homepage do you know what I’d need to change please? I tried the code which repeats the featured image above and below the title. Any guidance would be appreciated!

    Many thanks

    • Editor says

      Hi Dominic,

      If you’re using custom loop, I need to first see your code.

      Can you paste it in https://gist.github.com/ and share the link to the code here?

      • Dominic says

        Many thanks! the gist is at

        https://gist.github.com/anonymous/f6ee5cf930d9637c4327

        It’s taken from front-page.php

        Thanks in advance - Much appreciated!

        • Editor says

          Hi Dominic,

          Thanks for the gist. Looks nothing fancy in there.

          1. Do you enable HTML5 support to your theme? If you DO, then the above code won’t work as Genesis introduced new hooks for loop.

          Here’s for HTML5-enabled Genesis child theme: http://www.wpstuffs.com/how-to-switch-featured-image-above-the-title-in-genesis-framework/

          2. Looks like you’re using Genesis grid loop so that might be the reason too. Have you tried disabling featured image from the Genesis settings page? Since you’ve already defined the featured image in the Genesis grid loop code, enabling featured image from the settings page means you’ll have two featured image.

          Please let me know if that helps.

          • Dominic says

            Many thanks for investigating!

            It is based on Genesis 2.0 however the html5 code that you linked reverted the layout to how it was before (IE featured image below the header). When I turned the featured image off in the Genesis settings it simply removed both featured images.

            I don’t suppose you have any further thoughts?

            Many thanks again

          • Editor says

            I guess that’s because you’re using the genesis grid loop. Then, you need to refer to this tutorial http://www.billerickson.net/genesis-grid-loop-content/

Leave a Reply

Your email address will not be published. Required fields are marked *