Use a div for post info in Genesis

The “Genesis Post Info” displays the post date, author, and comment count above the post content. You can modify this content using the genesis_post_info filter.

The output is all wrapped in a paragraph –  <p class="entry-meta"> – inside the post’s <header>. You can modify this markup using the Genesis Markup API.

The code below changes the paragraph into a div: <div class="entry-meta">

<?php
/**
* Use a div for post-info, open
*
* @author Bill Erickson
* @see https://www.billerickson.net/code/genesis-post-info-markup
*
*/
function be_post_info_markup_open( $open, $args ) {
return sprintf( '<div %s>', genesis_attr( $args['context'], array(), $args ) );
}
add_filter( 'genesis_markup_entry-meta-before-content_open', 'be_post_info_markup_open', 10, 2 );
/**
* Use a div for post-info, close
*
* @author Bill Erickson
* @see https://www.billerickson.net/code/genesis-post-info-markup
*
*/
function be_post_info_markup_close( $close, $args ) {
return '</div>';
}
add_filter( 'genesis_markup_entry-meta-before-content_close', 'be_post_info_markup_close', 10, 2 );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk