Articles of conditional tags

How to use the conditional homepage tag

I’m trying to display a video in the header of the homepage only but struggling to figure out the correct code. This is the code for the video tag, which seems to be working fine if ( is_home() ) { ?> <video id=”example_video_1″ class=”video-js vjs-default-skin” controls preload=”auto” width=”1278″ height=”720″ poster=”” data-setup='{“example_option”:true}’> <source src=”″ type=’video/mp4′ /> […]

Include Buddypress & bbPress styles/scripts conditionally

I’m working on a custom theme that uses Buddypress and bbPress to add social network functionality. I’ve noticed that both plugins css and js (many files) are loaded on every page, even though none of the functionality is used there. For example, in my homepage I only have a link to the forums, so I […]

Is it possible to If statement “article already appears on page”?

Best is an example: Front page. I want to have a featured section at top. If A Science post is in my Featured, I don’t want it to also show in my Science section of the same page. Can I If-Statement this somehow? Like: “If the_post already appeared, do not list”? I’d like to add […]

How to conditionally output to sidebar of each author's archive and posts by each author?

Specifically, I am trying to conditionally hook a testimonial rotator into the sidebar of specific author archives and single posts for each specific author. Although I am using a specific example below, the general answer I need is how to conditionally check if I am on an author archive or single post by that author […]

Conditional Tags – Multiple Categories

I need to have all News posts show a category header (while not showing the post title). The following piece of code seems to do the job: if($category[0]->name == ‘News’){?> <script> jQuery(‘h1.entry-title’).html(‘<img style=”width:30px; margin-top:11px; margin-right:10px” src=”<?php echo home_url(”); ?>/wp-content/uploads/2015/07/news1.jpg”> News’); jQuery(‘#menu-item-11830’).addClass(‘current_page_item current-menu-item’); </script> <?php } ?> However I need this to work as well with […]

Three variables on conditional tags

I’m trying to return $ad_code if three variables are present, but it doesn’t allow the third variable I’m trying to add. I want to exclude a category. I am trying to use (in accordance with WordPress’ “conditional tags“) if ( is_single() && ! is_category( ‘1293’ ) && ! is_admin() ) { return prefix_insert_after_paragraph( $ad_code, 2, […]

is_singular() equivalent for backend

I use the conditonal function is_singular($my_post_type) inside my plugin and it is very convenient. The problem is that is doesn’t work backend. Is there an alternative that works frontend & backend ? Thanks !

page single conditional

Using underscores, I made a lot of small, simple custome themes. I was more interested in CSS and simple layout modifications, but I’m not used to vanilla PHP. What I need I think is a simple code, but I can’t wrap my head around it and I’ve been trying for hours. I’m trying to have […]

How can I get $pagenow equals to the Home Page or specific page on my site?

I’m new to WP and search for some examples on $pagenow codes. Everything I saw equals to .php files. How can I make an if statement that $pagenow is equal to my Home Page or specific page?

Multidimensional Array

I have an array in my wordpress template where i want to then target a specific status of the logged in user. Below is what i currently have with the $args containing a status with all the status values stored. $user_id = get_current_user_id(); $args = array( ‘status’ => array( ‘wcm-active’, ‘wcm-delayed’, ‘wcm-complimentary’, ‘wcm-pending’, ‘wcm-paused’, ‘wcm-expired’, […]