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

learn more… | top users | synonyms

0
votes
1answer
98 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
116 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
32 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
372 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
273 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
354 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
66 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
61 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
424 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
73 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
244 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
897 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
47 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

Having an extra submenu with this code in sidebar: <?php if(is_404() || is_search()) : ?> <?php echo 'zou leeg moeten zijn'; ?> <?php else : ?> <?php if($post->post_parent ...
1
vote
2answers
571 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
339 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
604 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
290 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
448 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
316 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
64 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
175 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
70 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
823 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
528 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
49 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
186 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
173 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
179 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
98 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
104 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 !
0
votes
1answer
18 views

Conditional display faults

I'm trying to get the line of codes below to display it's content on "web-design-portfolio" and "web-design-portfolio-2" but it ends up messing up every other pages on my website and displays the "Ul" ...
-1
votes
1answer
1k views

Woocommerce getting top level category parent and make all sub categories have the same template and menu

I want to get the top level category parent which is "wedgwood" so i give it a different menu and different template that what i wrote so far but it dont apply except on ‘wedgwood’ category wegdwood ...
1
vote
1answer
3k views

How to insert widget areas specific to certain pages (or posts, etc.)?

I am developing a theme the pages of which (as well as posts) are so different from the home page that I want different widgets on their sidebars.Is there a way to do it? I'm calling the sidebar on ...
0
votes
2answers
352 views

Show specific content on parent custom post type and all children

I have 5 main posts within a custom post type. Some of these posts will have children. I have content that should only be displayed on the parent post and all children of that post. What's the best ...
0
votes
1answer
678 views

Check if current page is wp-admin

I have created a common custom dashboard for my users located at "http://website.com/login/dashboard/" I'm trying to redirect users to that custom dashboard only if they are NOT admins & if the ...
0
votes
1answer
893 views

Add class to DIV depending on page loaded

I'm designing a new theme and in my page template a have a section where an image is displayed . I would like this image to change depending on which page is loaded. The section is a DIV like this: ...
1
vote
1answer
369 views

How to use is_feed() to target a category feed?

is_feed (one of the many conditional tags) can be used to determine if the current query is for a feed. But how do I use it to target all category feeds? (or tag or custom taxonomy feeds for that ...
0
votes
1answer
268 views

How to echo a different field if another field is empty?

I succeeded in getting both images and video to echo into a bootstrap carousel. However, I run into a problem when the post contains no images. If there are no images then there is no class="item ...
1
vote
1answer
432 views

Wordpress function like is_category for subcategory? is_subcategory?

Is there a function in WordPress that will check if the page you are on is a sub-category archive page? Like the way is_category checks if it's a category page?
0
votes
2answers
322 views

Excluding custom post types

I'm attempting to develop an is_blog() function which returns true if the current view is a single post, blog home, or post archive. I have successfully excluded pages and attachments. My current code ...
0
votes
1answer
97 views

Adding else if conditional statement to purchased theme

I purchased a theme that I want to change a bit. I'm familiar with writing some if/else statements but not this type and not matter what I do, I can't add an else/if without breaking the code. Below ...
1
vote
0answers
196 views

bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile

I've been trying to set a conditional for specific users (e.g. http://www.mywebsite.org/forum/users/john/) to display a custom "Contributor" graphic within their user profiles. The graphic would be ...
2
votes
1answer
454 views

Conditional based on the User Role of the Current Profile the user is viewing - BuddyPress [closed]

I'm using BuddyPress and need a certain block of code to show up on user role Store Owner profiles only. I'll be putting it in member_header.php, so it's just a template file. I've been digging for a ...
2
votes
1answer
306 views

is_home() in HTML head

Is there a way to check if the current page is the home page from within the head? My style.php needs the number of posts in the slider, but only on the home page. So I count my posts like this: ...