Support » Plugins » How to add a conditional to this code?

  • Resolved photocurio

    (@photocurio)


    add_action('below_header', 'flexx_feature_top', 11);
    	function flexx_feature_top() {
    		global $feature_top;
    
    		if ( ! empty( $feature_top ) && ( 'none' !== $feature_top ) )
    			get_template_file( 'feature-top.php' );
    	}

    This function adds a div with some widget areas to my theme: i.e. get-template_file( ‘feature-top.php’ ). Feature-top.php is the template file for the div.

    I want to add a conditional line that says “If this is a single post, don’t add the div”. But I don’t know the correct syntax.

Viewing 1 replies (of 1 total)
  • I got this:

    add_action('below_header', 'flexx_feature_top', 11);
    	function flexx_feature_top() {
    		global $feature_top;
    
    		if (( ! empty( $feature_top ) && ( 'none' !== $feature_top )) && ( is_front_page ))
    			get_template_file( 'feature-top.php' );
    	}

    My code puts the widget area on the front page only, instead of not putting it on single pages.

Viewing 1 replies (of 1 total)
  • The topic ‘How to add a conditional to this code?’ is closed to new replies.