Advertisement
fauzanjeg

Remove Social Share Button for Specific Post

Sep 15th, 2021
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. /* Remove Social Share Button for Specific Post */
  2. function remove_social_share_for_spesific_post() {
  3.     if ( is_single() ) {
  4.         $slug_post = get_post_field( 'post_name', get_the_ID() );
  5.         $list_post = array( 'the-legend-of-zelda-breath-of-the-wild-gameplay-on-the-nintendo-switch', 'slug-2', 'slug-3' ); /* By Post Slug */
  6.  
  7.         if ( in_array( $slug_post, $list_post ) ) {
  8.             remove_all_actions( 'jnews_share_top_bar' ); /* Top Position */
  9.             remove_all_actions( 'jnews_share_float_bar' ); /* Float Position */
  10.             remove_all_actions( 'jnews_share_bottom_bar' ); /* Bottom Position */
  11.         }
  12.     }
  13. }
  14. add_action( 'wp', 'remove_social_share_for_spesific_post' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement