• Hi

    I would like to exclude some pages where i dont want the share buttons to appear

    for instance, contact page doesnt need those share buttons

    How can i remove them from those pages ? with pages id’s ?

    Thank you for your help, appart from that your plugin is perfect !

Viewing 3 replies - 1 through 3 (of 3 total)
  • I wanted this as well, so I found a way to filter the results. Here’s how I did it:

    add_filter('dpsp_output_front_end_content', 'dbtours_cond_remove_socpug');
    
    function dbtours_cond_remove_socpug($output) {
    	global $post;
        $pages = array( 13, 15 );
        
        if ( in_array( $post->ID, $pages ) ) {
            $output = '';
        } 
        
        return $output;
    }

    Just add all the post/page IDs into the $pages array that you want to exclude.

    But the way the output is setup, just using that function above you’ll still get an empty div, and it you’ve styled that at all it’ll look weird. So add this custom CSS as well and you’ll be all set:

    div#dpsp-content-top:empty,
    div#dpsp-content-bottom:empty {
       display: none;
    }
    Thread Starter DeepBlue

    (@deepblue5)

    Tx a lot Matt ??
    i will try your code !

    Nice day !

    Hi !
    Thanks for this cool code @webdevmattcrom, I just have a question.

    Did you put this code in the index.php file ? I’m getting this error
    call_user_func_array() expects parameter 1 to be a valid callback, function 'dbtours_cond_remove_socpug' not found or invalid function name

    I included the following line in the index.php constructor:
    add_filter( 'dpsp_output_front_end_content', 'dbtours_cond_remove_socpug');

    then I put the following code among the other functions. Any idea what could cause this error ? I’m trying to make it so only my home page has these buttons

    function dbtours_cond_remove_socpug( $output ) { 
        		if ( !is_home() ) {
           	 		$output = '';
        		}   
        		return $output;
    	}
    • This reply was modified 7 years, 4 months ago by funianrun.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Exclude some pages’ is closed to new replies.