Display genesis post info on page content type

When working with genesis its a bit tricky to find the right functions and filters to do the necessary alterations.

I was trying to display the post meta ina genesis theme for the page content type but i was having some trouble making it show up.

The genesis visual hook guide plugin helps you identify the hooks but that is only scratching the surface when it comes to genesis, it has multiple layers of logic where you need or can tap into.

Display genesis post meta on page content type comes down to the following.

Since I wanted to place it in the header I naturally looked for

add_action( 'genesis_entry_header', 'genesis_post_info', 5 );

This was already in my theme and it was displaying the post info but only for posts not pages, so I looked into function genesis_post_info() inside:

\wp-content\themes\genesis\lib\structure\post.php

this was being called but it never got through the following condition

 if ( ! post_type_supports( 
get_post_type(), 'genesis-entry-meta-before-content' )
) {
    return;
  }

Basically meaning the we need to ad the “Page” content type to have support for `genesis-entry-meta-before-content`. So I looked where that is being handled. So I found this:

 /**
* Add post type support for post meta to all post types except page.
*
* @since 2.2.0
*/
function genesis_post_type_support_post_meta() {

  $public_post_types = get_post_types( array( 'public' => true ) );

  foreach ( $public_post_types as $post_type ) {
    if ( 'page' !== $post_type ) {
      add_post_type_support( $post_type, 'genesis-entry-meta-before-content' );
      add_post_type_support( $post_type, 'genesis-entry-meta-after-content' );
    }
  }

  // For backward compatibility.
  if ( current_theme_supports( 'genesis-after-entry-widget-area' ) ) {
    add_post_type_support( 'post', 'genesis-after-entry-widget-area' );
  }

}
in \wp-content\themes\genesis\lib\init.php

Basically page is being excluded from adding support for entry meta before content. Having a full understanding what I needed to do now the solution was simple.

Solution

Add support for ‘genesis-entry-meta-before-content’ for the page content type. To do that add these lines in your themes functions.php

#-----------------------------------------------------------------#
# Add Page to the list of content types that have the META 
#-----------------------------------------------------------------#
add_action( 'init', 'YOURPREFIX_genesis_post_type_support_post_meta');
function 'YOURPREFIX_genesis_post_type_support_post_meta(){
  add_post_type_support( 'page', 'genesis-entry-meta-before-content' );
}

I hope this helped, Cheers!