WordPress.org

Ready to get started?Download WordPress

Forums

WPSocialite
[resolved] Hide socialite on specific posts (4 posts)

  1. jmzolezzi
    Member
    Posted 1 year ago #

    I'm placing socialite buttons on the theme itself, placing the following code:

    <?php echo $wpsocialite->wpsocialite_markup('small'); ?>

    Is there any way to hide that on specific posts ID? I'd like to hide the share buttons on some posts / pages, but the plugins that have this feature are not as good performance-wise as this one :)

    http://wordpress.org/extend/plugins/wpsocialite/

  2. Tom
    Member
    Plugin Author

    Posted 1 year ago #

    First,

    Be sure to upgrade to the latest version. The new manual markup is <?php wpsocialite_markup(); ?>

    Second,

    Let me think about how to best implement a "hiding" function. For now, you could simply use something like this:

    <?php
    		$exclude_ids = array('1','60','62');
    		if(!in_array($post->ID, $exclude_ids)){
    			wpsocialite_markup();
    		}
    		?>

    This looks at the ID's you have specified in $exclude_ids, then says "If the current $post->ID is not one of these, then display the wpsocialite_markup function."

    Let me know if that helps.

  3. jmzolezzi
    Member
    Posted 1 year ago #

    That works perfectly well Tom, thanks!

  4. earwolf
    Member
    Posted 1 year ago #

    Hi Tom

    Does that code go in functions.php? Any particular place? I'm using Genesis and looking to exclude from pages such as http://educulture.com/newsletter-signup-successful/

    Ta
    KB

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic