WP SITES

2948 Tutorials & 189 Plugins

Move Portfolio Archive Entry Titles Below The Featured Image In StudioPress

By default, most portfolio archive pages display the title before the featured image.

title before image

If you want to reposition the title after the image, you can simply by adding a third parameter to the function.

title after image

Here’s the default PHP code you’ll find in the portfolio_archive.php page which displays the featured images below the titles.

//* Add the featured image after post title
add_action( 'genesis_entry_header', 'cpt_portfolio_grid');
function cpt_portfolio_grid() {

    if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
        printf( '<div class="portfolio-featured-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );

    }

}

All you need to do is add a priority number as a 3rd parameter to the end of the first line of code like this:

You can see the number 1 has been added at the end of the action.

add_action( 'genesis_entry_header', 'cpt_portfolio_grid', 1 );

So your entire code snippet will look something like this:

//* Add the featured image after post title
add_action( 'genesis_entry_header', 'cpt_portfolio_grid', 1 );
function cpt_portfolio_grid() {

    if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
        printf( '<div class="portfolio-featured-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );

    }

}

Simply increase the number from 1 to a higher number if needed.

Was This Tutorial Helpful?