functions that return a single boolean value depending on what is currently being viewed

learn more… | top users | synonyms

0
votes
1answer
54 views

how to show this part only in the single post page?

I have this part in my index-meta.php file : <ul> <li class="Source"><a>source:</a></li> ...
1
vote
1answer
100 views

custom comments on specific post type

I have a custom post type called debate and I want to create some custom fields just on this post type. So, I have this code: function debate_comment_fields( $fields ) { if( is_singular( ...
0
votes
3answers
280 views

Conditional Statements

I have created Custom Post Type called - listing Also created custom taxonomy - listingcategories In listing categories, i have created two categories music 2. features Now i want to create a ...
0
votes
3answers
125 views

Conditional tags not working

I'd like to display some CSS only for this page. In the theme's header.php, I have tried both: <?php if(is_page('events')) { ?> <style> #main { background-image: none; } ...
0
votes
0answers
151 views

is_page() is not executed

I am making infinite scroll page. I created a page template where posts of certain category are loaded. Everything works fine with a single page and single category. But I have three pages with this ...
0
votes
1answer
840 views

is_active_sidebar() Always Returns False

I've never gotten is_active_sidebar() to work, no matter if there's widgets in the sidebar or not I always get false returned. Currently I'm creating a sidebar for each top level page: ...
0
votes
2answers
72 views

Conditional Tag for sub cagtegories?

We have is_category() for categories, however I m not getting a conditional tags for subcategories, I want to enqueue script only on subcategories but on the parent. So lets say I have a parent ...
0
votes
4answers
194 views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
0
votes
1answer
87 views

conditional tags for the output of a plugin

I'm still quite a newbie developer so small problems like this bring me to a stand still from time to time. I've basically built a custom plugin to display pdf images next to a link very basic I ...
0
votes
3answers
147 views

Conditional for Post Format

I want to to show a specific content on the top of each post (on single page) depending of the post-type. If it's normal, show something, if it's gallery, show another. By now the code is like this: ...
0
votes
1answer
921 views

is_home() not working in functions.php file

I'm using woo themes and trying to use some woo hooks to hook into the index.php file from my child theme. I'm using the following code: function content_woo_main_before() { if (is_home() || ...
0
votes
3answers
355 views

Only show content if current page is NOT one of 2 page templates [closed]

I've been using this if conditional statement to only show content if the current page is NOT using a certain page template; if (! is_page_template('template-custom.php')) { <!-- show some ...
0
votes
1answer
742 views

Limit Contact Form 7 hook to specific form [closed]

I'm using a Contact Form 7 filter to take action after the email is sent. How can I limit this action to only one form? There are multiple forms on different pages, and I don't want this action to run ...
0
votes
0answers
427 views

is_home() and is_front_page() not working in sidebar

I'm trying to display a custom widget in the sidebar of my homepage (which is a static front page defined in Settings > Reading). Here is the relevant part of my sidebar.php: if ( is_front_page() ...
0
votes
1answer
120 views

Removing template part when not on homepage if / else

Thank you in advance for any help! What I am trying to do is remove a template part from my home page after the user clicks on the pagination links from the posts, right now my template part serves as ...
1
vote
1answer
122 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...
0
votes
1answer
35 views

Show content if page is a grandchild of top level page

I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy; - Top Level Page - Child Page - Grandchild Page ...
0
votes
2answers
398 views

Loading Scripts For Specific Template

I'm attempting to load a couple of scripts based on the template in use. However, the is_page_template is not activating. From my functions.php in the child theme I have: function sectionDescription ...
0
votes
3answers
327 views

Get template part based on custom taxonomy term

I have a custom post type and I'm trying to call up different variations of the navigation based on the custom taxonomy slug. I've done this fairly easily with normal posts, like so: <?php ...
0
votes
2answers
394 views

If is_single in functions.php

I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there. I use the following rule and it is in my ...
-1
votes
1answer
81 views

Using Conditional Tags to restrict something to 1 user?

I am using the following widget http://wordpress.org/plugins/widget-logic/ This allows me to restrict widgets using WP Conditional tags. What I want is to restrict one widget to only 2 users. ...
0
votes
1answer
63 views

Checking for 'gallery' shortcode using strpos always returns false

I want to conditionally enqueue a script and stylesheet depending on whether the [gallery] shortcode is used in posts. Here is how I am doing it (based on): function doraemon_scripts() { if( ...
0
votes
2answers
515 views

Don't show certain div on front page?

I have CSS issues with a certain div only on the front page (front-page.php). As I can't fix it, I was thinking about removing the item, but only on the front-page. I'm not exactly sure how I have to ...
0
votes
1answer
78 views

Variable Not Working Inside is_author() Array

I'm using a plugin (User Groups) to separate out users into, well, groups, and I need to figure out a way to create a conditional to check if an author is in a certain group. So, using get_term_by and ...
1
vote
1answer
328 views

What is the condition to check if we are in admin or frontend?

What is the condition to check if we are in admin or frontend? I want to add_action not in backend, but only in frontend.
0
votes
1answer
1k views

conditional statement for custom taxonomy

Struggling to find out how to achieve this, if it is at all possible. The equivalent of is_category but for a custom taxonomy I've set up. The taxonomy category if which being Taxonomy Name with 2 ...
0
votes
0answers
22 views

Template is different with and without comments

My referenced website is at http://angelopardo.com/wakeupbeast and I've built it as a child theme of twentytwelve. Pages and single posts that have comments are displaying correctly, where the ...
-1
votes
2answers
48 views

Can't seem to get an else statement correct? [closed]

I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing ...
1
vote
1answer
1k views

Is_search not working on search results page

I have an extra submenu with this code in the sidebar: if(is_404() || is_search()) : echo 'should be empty'; else : if($post->post_parent == '68') $children = ...
1
vote
2answers
654 views

Conditional tag in Widget Logic for checking if top level page or if subpage

I'm using the Widget Logic plugin to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code). What I would like to do is only show a widget on child pages, not top ...
0
votes
1answer
452 views

How to check if post has any tag?

I am displaying post tags like this: <div class="tags"><?php the_tags('<span>Tags</span>' , ' '); ?> </div> It works fine, but if the post does not have any tag, then ...
1
vote
1answer
731 views

Conditional statement for parent, child and grandchild pages

I'm trying to figure out how to set up a conditional statement to check if the parent, child or grandchild is being displayed. This is what I've got so far: <?php if ( is_page( 'about' ) || '29' ...
0
votes
1answer
323 views

advanced custom fields: repeater field within conditional statement [closed]

I'm trying to figure out if it's possible to have a custom field within a conditional statement. e.g— if ( is_page( 'about' ) || '29' == $post->post_parent ) { //custom field goes ...
0
votes
1answer
48 views

conditional: if is page, and all subpages

What I'm currently trying to achieve is displaying certain menus on certain pages using one template and conditional statements, like so: if (is_page('donate')){ wp_nav_menu(array( 'menu' ...
0
votes
1answer
57 views

Is there a reason I cannot get the current category in a loop?

I think I am doing this wrong but if I do: if(have_posts()){ $category_id = get_query_var('cat'); var_dump($category_id); while (have_posts()){ the_post(); } } the var dump ...
0
votes
2answers
26 views

Why might conditionals not work on a page?

<?php if (is_single()) { echo '1'; } elseif ( is_page() ) { echo '2'; } else { echo '3'; } ?> I put this snippet at the top of index.php, which is what I'm using to govern the ...
0
votes
1answer
502 views

If custom taxonomy else conditional [closed]

I have a menu that I only want to show on certain pages using the following code: <?php if ( is_front_page() || is_archive() || is_404() ) { } else { if ( function_exists('has_parent') ) { ...
0
votes
1answer
348 views

If tag exists, then echo once

I have the following code and I'm trying to check to see if a specific tag exists, and if so, I need to echo it once. The problem is when the tag exists in multiple places, it echos multiple times. ...
0
votes
2answers
66 views

Php markup question: php/html within conditional bit

I'm getting very confused trying to get an existing bit of code to work within a conditional if/else bit of code. I can't get the syntax correct. All the echo commas and semi colons (sorry I'm not a ...
0
votes
2answers
181 views

static landing page leading to author specific pages w/ “live” content

My site has a static landing page with buttons to go to Cait's content or Shannons's content. Each author's page will feature their own posts, as well as a section with their social media streams. It ...
0
votes
0answers
72 views

Conditional logic for the new 3.6 structured post formats

Currently i have couple of custom fields in a custom metabox for post format options, like link url, video embed code etc... This works fine in version 3.5 and below. Now, with the new soon to be ...
0
votes
2answers
947 views

Disable CSS for IE 8 and earlier.

I am trying to find a way to disable the twenty twelve stylesheet for anything in IE 8 or less. Is there a conditional code that I can put in my functions php file that will enable the default ...
0
votes
2answers
619 views

Set conditional on template based on referring page slug

I have a portion of a page template that is conditional upon the following elseif <?php elseif( isset( $wp_query->query_vars['details'] ) && $wp_query->query_vars['details'] == ...
0
votes
1answer
51 views

How to get type of archive whether it is post or date or category archive?

using function is_archive() we can know whether it is archive page or not. But if it is archive page how can i find whether it is author archive page or category archive or date archive. I have ...
1
vote
2answers
199 views

Output 2 items within the Loop

I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one? // 5 list items ...
0
votes
1answer
221 views

If 'editor' is empty, then

Is there a way to write a php conditional in WordPress that says: "If 'editor' is not filled out (i.e. empty), then, do some code..." I know it's sort of a strange request but basically I have a ...
0
votes
1answer
211 views

Custom Function for Portfolio Archive Template With Conditonal Tag

Can't work out which conditional tag to use to add a page title to the portfolio archive page which uses custom posts types. This doesn't work: if( is_archive('portfolio') ) echo '<div ...
0
votes
0answers
107 views

Custom Post Query Combined with Conditional Tags

Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags? Below is what I have so far, basically if there are 4 posts or less show the posts, if ...
0
votes
1answer
50 views

Conditional menu display

I have the line of code below with the intention to display the called menu in every other page except the home page but it still shows up on the home page. Any ideas what the problem could be. ...
-1
votes
1answer
118 views

How can i hide content if not friend in Buddypress? [closed]

How can I hide some specific contents or div or other stuff depending on being friend or not in buddypress ?? I tried to use the bp_is_user_friends() function but it did not work !