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

learn more… | top users | synonyms

0
votes
2answers
97 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
242 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
88 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
296 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
215 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
100 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
165 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
471 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
107 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
496 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
1k 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
192 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
102 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
237 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
376 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
231 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
390 views

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

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
205 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
116 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
83 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
269 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
66 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
99 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
97 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( ...
1
vote
2answers
133 views

How can I link a CSS file only on single posts?

If I understand is_single() correctly, it's only supposed to return true when the current "post" (in a generic sense) is a literal post (i.e., it has a post_type of post), and that it will return ...
0
votes
1answer
798 views

conditional shortcode not working

I'm using a plugin, NextGEN gallery, to display photos. Each gallery from this plugin corresponds to a different sub-page, so I'm using conditional shortcodes to assign the right gallery to it's ...
0
votes
1answer
41 views

Targeting all pages except top level pages

I have used '0' == $post->post_parent successfully in my templates to target top level pages. However, I cannot seem to target all pages EXCEPT top level pages: <?php if ( '0' !== ...
0
votes
1answer
101 views

Conditional tag to show content in custom rss feed?

The wonderful answer here helped me create a custom RSS feed, and that's one major part done. I know that there's the is_feed conditional tag to show content only if it's a feed. But is there a ...
0
votes
1answer
65 views

nested conditional to check for feature image and custom field?

I have this working for the most part, but some of the syntax is wrong someplace because when the post DOESNT have a thumbnail, it still prints that last echo and closes a div outside of the ...
0
votes
1answer
152 views

Display Latest Post on a Page Conditionally

So I'm wondering exactly how I could display my latest post on a page only in certain conditions. I've been looking over the conditions page in the codex, but I'm not seeing how I could do what I have ...
1
vote
1answer
123 views

conditional tags- how to use with shortcodes

I have a salon website with a gallery page wherein the user must first select a stylist prior to viewing their individual gallery. I planned on using NextGen to house the images in stylist specific ...
0
votes
1answer
124 views

Display a widget on a specific type of archive

I have two sidebar widgets, I need to display 1 widget on the archive pages for the standard post categories and the other widget needs to show on just the archive pages for a specific custom post ...
1
vote
1answer
156 views

is_page conditional question

I am using is_page in my functions.php file to display some code and I wanted only to display the code in the header if the contact page is being shown. I made a template called contact.php and in the ...
0
votes
1answer
334 views

Category Template: Need to display different content on first page of archives

So my issue is that I need to create two versions of a category.php template. Now, I know very well that if I want to display posts from just one category, I duplicate category.php and call it ...
0
votes
1answer
67 views

For what queries is conditional tags informative?

I think it's great to use conditional tags but if the query is slightly advanced it won't give information about the original query. For example; is_category('apple') might give a false response if ...
0
votes
2answers
752 views

if custom posts type exists and there are posts load script

I have registered a custom post type 'featured_post'. I am looking for a way to test if the blog home page has any 'featured_post' posts on it and if it has load a javascript file. The ...
1
vote
1answer
307 views

Way to check if we are in Theme Customizer mode? [duplicate]

Possible Duplicate: How to execute conditional script when on new customize.php (Theme Customize) screen Is there a Conditional Tag, or any other method, that we can use to check if we are ...
0
votes
2answers
453 views

show div only if have a related post inside

I want to have a related box to show up - but only if a related post is inside the div. If theres no post the whole "related_box" div should be not shown. Any idea? Here's the code so far. ...
1
vote
3answers
451 views

Check if home.php and set home.php as page_on_front

I want to include a custom inline js on home page only. I havent set home page from reading section. I am using home.php file. function print_my_inline_script() { if (is_home() && ...
0
votes
1answer
359 views

Proper WP conditional tag to check for existing taxonomies to list out terms with wp_list_categories?

This is what I currently have but its not rendering any results... It was the closest conditional I could think of using to match what Im trying to output but it didnt seem to work. Any ideas?... ...
0
votes
2answers
1k views

Conditional tags issue for multiple is_page() conditions in sidebar.php

I've been pulling my hair out today trying to get this right. Basically I have a sidebar, which makes requests to individual files (such as sidebar-home.php, sidebar-residential.php) and different ...
0
votes
1answer
207 views

How to check if post/page or taxonomy post is published by admin

Example :- 10 users and 2 admin in a site. If the post is published by admins than <?php ?????() { ?> <!-- do this --> <?php } else { ?> <!-- do this if posted by ...
0
votes
2answers
268 views

CSS Customizations for certain page

I've been using Wordpress for a while, and came to a point where I need to make css customizations, but only for a certain page. I know that one way to do this is to use conditional tags: if ( ...
0
votes
1answer
312 views

wp_enqueue_scripts called twice?

I had some problem with WP recognizing a is_single condition for loading scripts called in function.php. I put a error_log(is_single()) to check what was going on. When opening a post page the log ...
2
votes
1answer
287 views

Bulk add tag (or any sort of label) to posts who have custom excerpt

The situation is the following: The blog as of now has 2200+ posts. In the beginning (2007/2008) I was using manual excerpts where I would put an image and a little bit of text. The manual excerpt ...
0
votes
3answers
1k views

Using a conditional tag for the home page banner

I'm setting up my wordpress website on my server now and have the rotating images on the home page and it's beautiful, but now I want to have a conditional tag telling wordpress if it's not the home ...
1
vote
1answer
310 views

Check if page/post has any anchors that link to an image jpg/gif/png

What I'm aiming to do is add fancybox to a site I'm developing, but I only want to enqueue the JS/CSS etc if the page/post needs it. My thoughts are that I would need to check all the anchor tags on ...
0
votes
1answer
233 views

do add_action on condition

This snippet for example will email on EVERY post: function email_friends( $post_ID ) { $friends = 'bob@example.org, susie@example.org'; wp_mail( $friends, "sally's blog updated", 'I just put ...
0
votes
2answers
60 views

Different sidebars not changing

I dont understand why my sidebar isn't changing over to the second one on the other pages. I've gone in an told the pages that if your not on this page show sidebar 2. So the home page and blog page ...