Viewing 1 replies (of 1 total)
  • Plugin Author Andrés Villarreal

    (@andrezrv)

    Hi, sorry for the delayed answer.

    You can use the plugin functionality in your code passing the shortcode arguments as an array to the Hide_This class.

    Here’s an example of how it can be done:

    // Put the content you want to show or hide conditionally inside a variable.
    $content = 'My HTML contents.';
    
    if ( class_exists( 'Hide_This' ) ) {
    	// Construct an array with the shortcode arguments.
    	$atts = array(
    		'for'     => 'all',
    		'exclude' => 'username:foo',
    	);
    
    	$hide_this = new Hide_This( $atts, $content );
    
    	echo $hide_this->content;
    } else {
    	echo $content;
    }

    You can see the full list of arguments and accepted values here: https://www.ads-software.com/plugins/hide-this/.

    Hope this helps ??

Viewing 1 replies (of 1 total)
  • The topic ‘php code in header’ is closed to new replies.