• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2785

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

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' )
  • More code examples on Github.
  • Download plugin from the WordPress plugin repository.

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags
 

Loading Comments...
 

You must be logged in to post a comment.