I'm using the Genesis framework and trying to add some bits under the content.
I want them to appear on just the homepage, so I'm currently using this code, however it's including on all pages.
I have a feeling the if statement is wrong...
add_action( 'genesis_after_content', 'sp_homepage_content' );
function sp_homepage_content() {
if ( is_page('2') )
include ('includes/homepage-content.php');
}
EDIT: I think i fixed it with the following:
add_action( 'genesis_after_content', 'sp_homepage_content' );
function sp_homepage_content() {
?>
<?php if ( is_page('2') ) { include ('includes/homepage-content.php');} else ?>
<?php
}
Although I'm not sure if that's "good" code... It works
Change your condition to if(is_home())
.
add_action( 'genesis_after_content', 'sp_homepage_content' );
function sp_homepage_content() {
if ( is_home() )
include ('includes/homepage-content.php');
}