• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2669

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Tutorial Requests
  • Contact
  • Videos
  • Tags
  • Log in

Premium Member? - Request custom code

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.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Brad Dalton Specializes In Genesis child theme customization & code modification. Read More…

Learn PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems