Posts

custom_contentFor a client’s blog website I need to add a para automatically after each single post, found a snippet from Jeff Starr using a WordPress hook. Here’s how to do.

add_filter('the_content', 'add_post_content')
function add_post_content($content) {
	if(!is_single()) {
		$content .= '<p>YOUR CONTENT GOES HERE'</p>';
	}
	return $content;
}

If you enjoyed and find helpful this article, please consider sharing it.

Sometimes need to change the Genesis‘s default content on demand of client to show clients requirement (i.e. footer logo, remove back to top, credential change, add footer link).

Agency-Child-Theme-Demo-built-on-the-Genesis-Framework-by-StudioPress

 NOTE: When writing your own code/filters, use a child theme. Do not write to the default functions.php file in Genesis. It will overwrite on updates.

See below for codes I wrote to change Genesis Footer Content on child themes.

Customize the footer creds text

add_filter('genesis_footer_creds_text', 'auc_footer_creds_text');
function auc_footer_creds_text($creds) {
$creds = '©' . date('Y') . ' '
. get_bloginfo('name') .
'. All rights reserved. Powered by <a href="http://wordpress.org/">WordPress</a>.';
echo $creds;
}

Remove Footer Content

This will remove the footer credits text and ‘back to top’ link.
add_filter('genesis_footer_output', 'footer_output_filter', 10, 1);
function footer_output_filter($footer_content) {
$footer_content = '';
return $footer_content;
}

Add a WordPress Custom Menu in Custom Footer.

This will remove the default footer with credit text and Back to Top and add a WordPress custom navigation menu.
remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'auc_do_footer' );
function auc_do_footer() {
$creds = '© Copyright '. date('Y') . ' ' . get_bloginfo('name') . ' . All rights reserved.';
$footernav = wp_nav_menu( array('menu' => 'footer' ));
echo $footernav;
?>