Tutorials

Genesis to Kadence Code Snippets

(This post contains affiliate links. Read my full disclosure.)

Moving from Genesis to Kadence and need to replace some of your Genesis functions? Want to add a disclosure statement before your posts but don’t have the Elements available with Kadence Pro?

Install the Code Snippets plugin, if you haven’t already, and try these snippets that use Kadence Theme hooks to recreate what you were doing in Genesis.

add_action('kadence_single_before_entry_content', 'gl_before_entry_disclosure', 5);

function gl_before_entry_disclosure(){
	
	if ( is_single($post) && has_tag( 'affiliate' ) )  {
		echo '<center>(This post contains affiliate links. <a href="https://gretchenlouise.com/disclosure/">Read my full disclosure</a>.)</center>';
	}
}

add_action('kadence_single_before_entry_content', 'gl_before_entry_disclosure', 5);

function gl_before_entry_disclosure(){
	
	if ( is_single($post) && in_category( 'affiliate' ) )  {
		echo '<center>(This post contains affiliate links. <a href="https://gretchenlouise.com/disclosure/">Read my full disclosure</a>.)</center>';
	}
}

add_action('kadence_single_before_entry_content', 'gl_before_entry_disclosure', 5);

function gl_before_entry_disclosure(){
	
	if ( is_single($post) )  {
		echo '<center>(This post contains affiliate links. <a href="https://gretchenlouise.com/disclosure/">Read my full disclosure</a>.)</center>';
	}
}

/**
 * Adapted from Bill Erickson's Modified Date
 *
 * @link https://www.billerickson.net/display-last-updated-date-on-articles/
 *
 */
function post_modified_date() {
	$updated = get_the_modified_date( 'U' );
	$output .= get_the_modified_date( 'F j, Y' ) . '';
	return $output;
}
add_shortcode( 'post_modified_date', 'post_modified_date' );

Leave a Reply

Your email address will not be published. Required fields are marked *