Show Genesis Simple Share Icons On Specific Pages

A good question from a member of the genesis community:

I installed Genesis Simple Share and enabled posts and pages. But, I only want Simple Share to show up on 2 specific pages, not all of them. Is there a way to restrict Simple Share to show up on specific pages? I’m using WordPress 4.7.4 with Genesis 2.5 and Parallax Pro.

There’s 2 steps to display Genesis Simple Share icons on specific pages.

Step 1 : Configure the plugin options so the icons don’t display :

Step 2 : Once you’ve disabled the output, you can then add PHP code to your child themes functions file with a conditional tag to control the output of Genesis Simple Share icons.

add_action( 'genesis_entry_content', 'prefix_entry' );

function prefix_entry() {

    if ( ! function_exists( 'genesis_share_icon_output' ) ) {
		return;
	}
	
	if ( ! is_page(array( '3887','3889' ) ) ) {
	    return;
	}
	
	global $Genesis_Simple_Share;
		 
	echo '<div class="share-box"><p class="share-headline">' . __( 'If you liked this article, tell someone about it', 'yourtextdomain' ) . '</p>';
	genesis_share_icon_output( 'after-entry', $Genesis_Simple_Share->icons );
	echo '</div>';
}

Swap out the page i.d’s in the array to match your own:

array( '3887','3889' )

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.