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

learn more… | top users | synonyms

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" ...
0
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
365 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
771 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
1k 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
413 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
290 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
528 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
345 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
98 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
222 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
501 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
360 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: ...
0
votes
2answers
1k views

How to check with is_page if 404.php is loaded?

I want to check if current page match at least one of two conditions. I don't want to show js code into about page and into 404 page. For the rest of my pages i show the js code. So, I use ...
0
votes
1answer
71 views

is_mobile as shortcode

I installed the Plugin "mobble" which provides some more conditional tags. As I want to hide some content for mobile devices I tried to build a shortcode [is_mobile]. But I tried many different ways ...
2
votes
1answer
38 views

How can i know when i can execute what functions of wordpress?

I like to do a bunch of stuff only on homepage and archive pages i am working with the genesis framework (not really matters i guess) if( is_singular() ) { wp_die('functions.php'); } ...
1
vote
1answer
271 views

Checking whether template part is loaded in a page

I have a template part like this: <nav id="subpagemenu" class="sidebar"> <?php get_template_part( 'nav', 'subset' ); ?> <?php get_sidebar(); ?> </nav> Both of these ...
0
votes
1answer
39 views

Conditional Custom Image Header

I thought there was a conditional for a custom image header that could check whether an image had been added (not whether the feature was enabled, but actually being used). I wanted to use it to add a ...
1
vote
1answer
66 views

Taxonomy Tag Conditionals

I'm using jigoshop as main ecommerce plugin. Jigoshop use Taxonomies call, product_cat and product_tag. In my theme I use a default (h5bp) 404.php, so every time a tag doesn't exist I get the ...
0
votes
1answer
239 views

Conditionals: What is wrong with my if/else statements? [closed]

<?php if( $settings['logo']) : ?> <a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img ...
0
votes
1answer
187 views

Trying to place shortcode/css/html into an IF conditional statement

With the WooCommerce plugin, I'm trying to get a different template/look to apply to the individual product page depending on what category the product is in. In other words, I want a product within ...
0
votes
1answer
124 views

Only on single post page

I am using this code to show ad below single post but only if it is in specified category. Code is giving right out put but it is also showing up on archive pages. I just want to show on single post ...
0
votes
1answer
214 views

Conditional tag to determine if the user is viewing the Add Media (after clicking Add media button)

Is there a WordPress conditional tag for checking if the user is viewing the add media popup after clicking the Add media button? If none, is there an alternative function that can be used? Thanks ...
-1
votes
1answer
84 views

Quick Conditional Tag Question if elseif [closed]

I have a meta box checkbox, you click to turn on/show the blow info basically... These conditionals dont seem to be working for some reason, the first if works, but when i add in any other else if it ...
0
votes
2answers
109 views

page 1 is not paged

I have rules that only work on paginated pages (is_paged). However, they don't work on page number one (/page/1). This one is behaving exactly like the homepage (!is_paged), but unlike pages 2,3,4 ...
1
vote
1answer
288 views

How can I hide tags on a child-category page, if that tag has not been used?

I have a section of my site where I'm using child-categories and tags to sort content. I'm have a tertiary navigation for the tags (templates/nav-tags.php): <nav class="side left"> <ul ...
-1
votes
1answer
32 views

problem with not displaying content on selected pages

My objective - Display some code on every page apart from 2 pages. Now this code works fine with only one page (if its not is_home, display code)... <?php if (!is_home()) { ?> (some ...
0
votes
1answer
89 views

Showing code only on Front Page “Posts Page”

I have some code that I would only like to be displayed on the sidebar when on the blog (the page that displays the posts). Now I am using this code... <?php if(is_page('37')) { ?> ...Show ...
-1
votes
1answer
379 views

hide block of code from showing on certain pages

Just to warn you, I am a complete PHP novice! I have one sidebar for all pages, however I would like to display certain elements on this sidebar for certain pages. I know there are a few widget ...
0
votes
1answer
240 views

Detect if request is coming from wordpress conditional statement

I don't even know if this is possible and my search terms in google are not doing any good. Since the site URL and blog URL are different I had to fix the post preview bug by giving wordpress it's ...
0
votes
1answer
111 views

Show posts containing or not custom field

I'm trying to show aditional posts in the author's page. This page must have posts containing a specific meta_key and meta_value, where the displayed author it is not really the WP post's author. ...
-2
votes
1answer
213 views

Weird html output of single_cat_title - is not inside of the html element?

I'm displaying a single "featured" post at the top of the blog index page, and category pages. I'm using this conditional to display the category name of the category page if it is a category page, ...
0
votes
2answers
586 views

Using has_tag() outside loop

I want to if the check next post has a specific tag. I tried the following code, but it is not working because has_tag() only works in the loop. I want to use it outside the loop. <?php if ( ...
0
votes
3answers
119 views

How do I add a nested conditional within an echo - to use a default image if there isn't one in the post?

I'm trying to add a conditional that will display a default image if the "image" field isn't populated... here's what I'm trying to work with: $args = array( 'posts_per_page' => 3, ...
1
vote
1answer
665 views

How can I achieve something like has_post_format( 'standard' )?

In opposite to get_post_format, the conditional has_post_format() function returns a boolean value and should be the perfect function for a conditional check like: if ( has_post_format( array( ...
0
votes
3answers
2k views

Show content if parent page has children

Using this piece of code you can show content depending if it's a child-page or not: <?php global $post; if ( is_page() && $post->post_parent ) : ?> This is a child-page. <?php ...
1
vote
1answer
205 views

Check if post has gallery images/media

Is there a Wordpress conditional that I can use to check for gallery images/media in a post? I do not want to check if the [gallery] shortcode exist in a post. Attached is a screenshot of what I ...
0
votes
1answer
112 views

Conditional for a Single Post That Belongs to a Category?

I have categories like gaming and movies on my website and when a user visits any of these categories the content in the sidebar is displayed depending on the category they are in. So gaming content ...
0
votes
2answers
264 views

Display latest post depending on Meta Box content

What I want to do is display my latest post's content on a custom template page, ONLY if a meta box is filled in with the right word. In other words, if the post has a meta box named, "FEATURED" with ...
1
vote
1answer
455 views

Using Conditional Statement in functions.php

I've got this code below in my functions.php and I'd like to add two filters with conditional statement not to effect every query_posts. Something like this if(!is_admin() && ...
0
votes
1answer
260 views

Sub-category single post styling?

*CLARIFICATION: I'm trying to style the single post view of some categories & sub categories. The suggested solution works, but only on a page of posts from the selected categories. Eg. If a post ...
1
vote
1answer
504 views

How to check if the current page is a “personal activity”-page in buddypress? [closed]

I want to modify some general text in my personal-activity page in buddypress. Does any one know any conditional tag like is_page('activity') things are there for checking this? the page can be ...
0
votes
1answer
246 views

Exclude custom function content from certain pages

I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is ...
2
votes
1answer
138 views

Featured Image Size Conditional Tag?

Is it possible to check what image size has been selected for the featured image and only display that image.. For example. <?php if(has_post_thumbnail('small-image')): ?> ...
0
votes
1answer
97 views

Run a php function if a predefined page is visited

I use the CubePoints plugin that rewards users with 1000 points via the following function: if( function_exists(‘cp_alterPoints’) && is_user_logged_in() ){ ...
0
votes
1answer
307 views

Testing for a shortcode using a function. 404 page throwing PHP Notice

I'm using the following function (can't remember where I found it, but I think it was written by pippin so thanks to him) to test for a shortcode. function has_shortcode($shortcode = '') { ...
0
votes
1answer
72 views

Highlight comments made by registered users of the site

How can I highlight comments that have been made by registered users of my blog?
0
votes
1answer
117 views

Conditional Tag Based on Age of Post [duplicate]

Possible Duplicate: Add inline HTML to posts published within last 24hrs I've been searching through the codex and Google and cannot not find a conditional tag based on age of post. I'm ...
3
votes
1answer
103 views

Possible to use conditionals within add_feed() callback?

I'm using add_feed() to create some custom feeds but calls to is_singular(), is_home() etc... just don't seem to work within the callback. Is there a workaround for this? Example code: add_action( ...