Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi Paul,

    Yes, this is customisable although it does require some custom code at the moment.

    You can use the mctp_show_bar filter to specify on which pages the plugin should be shown.

    The following might be too technical perhaps but just in case it isn’t: the filter accepts a boolean, false if the bar should not be loaded and true if the bar should be loaded for the current page.

    add_filter( 'mctp_show_bar', 'myprefix_show_bar' );
    
    function myprefix_bar() {
    
    	// only show on single posts and pages
    	if( is_single() ) {
    		return true;
    	}
    
    	return false;
    }

    Or, to only show on the home page.

    add_filter( 'mctp_show_bar', 'myprefix_show_bar' );
    
    function myprefix_bar() {
    
    	// only show on the front page
    	if( is_front_page() ) {
    		return true;
    	}
    
    	return false;
    }

    For an overview of all conditional tags, please have a look here.

    The above code snippets can be added to your theme its functions.php file.

    Another option is to wait until I build an easier way to do this into the user interface of the plugin. ??

    Hope that helps Paul!

    Plugin Author Danny van Kooten

    (@dvankooten)

    PS. I made a mistake in the above code examples, the correct code looks like this (fixed function name)

    add_filter( 'mctp_show_bar', 'myprefix_show_bar' );
    
    function myprefix_show_bar() {
    
    	// only show on single posts and pages
    	if( is_single() ) {
    		return true;
    	}
    
    	return false;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Opt-In Bar Locations’ is closed to new replies.