Community Forums › Forums › Archived Forums › General Discussion › Reposition the entry header
Tagged: blog page template, genesis
- This topic has 4 replies, 2 voices, and was last updated 8 years, 5 months ago by te1.
-
AuthorPosts
-
September 2, 2015 at 8:04 am #164326te1Member
Hi all,
I am trying to reposition all page titles inside of the entry header, however on my blog page (using the blog page template) it has removed all of the post titles. How can I reposition the page title without affecting all the other titles?
Here is my code:
//* Reposition the entry header remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_before_content', 'custom_genesis_entry_header_markup_open', 5 ); function custom_genesis_entry_header_markup_open() { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $video = get_field('featured_video'); if($video) { printf( '<header %s><video src="' . $video . '" poster="' . $image[0] . '" width="" height="" controls preload></video>', genesis_attr( 'entry-header' ) ); } else if(!empty($image)) { printf( '<header %s style="background-image:url(' . $image[0] . ');">', genesis_attr( 'entry-header' ) ); } else { printf( '<header %s style="background-image:url(' . get_stylesheet_directory_uri() . '/images/fire-risk-assessment-bg.jpg);">', genesis_attr( 'entry-header' ) ); } } add_action( 'genesis_before_content', 'genesis_entry_header_markup_close', 15 ); add_action( 'genesis_before_content', 'genesis_do_post_title' );
Any help is much appreciated.
http://boxchilli.co/fsssouth/blog/September 2, 2015 at 1:47 pm #164355pxfortiParticipantYou need to wrap you code in a wordpress conditional; eg
function move_post_title() {
if ( !is_single() ) //if not a single post, do nothing
return;
// your code here
}
writeNowDesign
WordPress and Ecommerce Website DesignSeptember 4, 2015 at 4:21 am #164543te1MemberHi pxforti,
I tried your approach but it didn't work.
Here is my code:
function move_post_title() { if ( !is_single() ) return; //* Reposition the entry header remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 ); remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 ); remove_action( 'genesis_entry_header', 'genesis_do_post_title' ); add_action( 'genesis_before_content', 'custom_genesis_entry_header_markup_open', 5 ); function custom_genesis_entry_header_markup_open() { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); $video = get_field('featured_video'); if($video) { printf( '<header %s><video src="' . $video . '" poster="' . $image[0] . '" width="" height="" controls preload></video>', genesis_attr( 'entry-header' ) ); } else if(!empty($image)) { printf( '<header %s style="background-image:url(' . $image[0] . ');">', genesis_attr( 'entry-header' ) ); } else { printf( '<header %s style="background-image:url(' . get_stylesheet_directory_uri() . '/images/fire-risk-assessment-bg.jpg);">', genesis_attr( 'entry-header' ) ); } } add_action( 'genesis_before_content', 'genesis_entry_header_markup_close', 15 ); add_action( 'genesis_before_content', 'genesis_do_post_title' ); }
Please can you help me with this as I am still learning.
Thank you.
September 4, 2015 at 10:31 am #164590pxfortiParticipantSorry about that.
You need to add this above the code:
add_action('genesis_before', 'move_post_title');
writeNowDesign
WordPress and Ecommerce Website DesignNovember 2, 2015 at 10:29 am #169879te1MemberHi all,
I'm bumping this post as what I tried didn't work.
Any help is much appreciated.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.