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

learn more… | top users | synonyms

1
vote
2answers
148 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
895 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
49 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
110 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
67 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
156 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
133 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
162 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
182 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
411 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
933 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
428 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
571 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
529 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
390 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
2k 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
217 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
322 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
379 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
321 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 ...
2
votes
1answer
338 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
284 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
62 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 ...
2
votes
1answer
1k views

Problem using is_single() to enqueue script from functions.php

I'm having trouble only adding scripts to single post pages. I need to both include and exclude certain scripts using is_single() but it doesn't work either way I try it. I have the template tag on ...
0
votes
1answer
108 views

PHP if statement printing the if parameters

So I've got a list of posts on the right side of a page. I'm trying to make it so that when you're looking at one of the posts the corresponding link (on the right side of the page) is selected (just ...
2
votes
1answer
382 views

Closest thing to an is_widget() tag?

I have a custom widget with a WP_Query loop that's using get_template_part() to include some standard information that I also use in theme files. However, I need to make one small change to the ...
0
votes
1answer
2k views

Why is wp-login redirecting to the home page when I use this function?

I'm perplexed; I can't see where I'm going wrong with this code. It should redirect any subscriber-level users back to the site home page if they try to access anything within /wp-admin - but not if ...
1
vote
1answer
3k views

If on term-page -> get the current term?

I'm trying to write a kind of "breadcrumb" function in my "functions.php" I'd like to query if I'm on a term-page and if so I want to print the current term I'm in. By "term-page" I mean the ...
1
vote
1answer
119 views

WordPress conditionals not working

Hi I am building a jquery accordion which works fine on my site. However I am now trying to introduce conditionals to only enable it on posts and pages, however it doesn't work, it seems the ...
6
votes
1answer
3k views

How to determine whether we are in add New page/post/CPT or in edit page/post/CPT in wordpress admin?

This seems like simple thing but I need way to determine whether the current screen is for Add New or Edit ( a sort of wordpress admin conditional tag). Is there a built in function for this already, ...
0
votes
2answers
101 views

Will multiple conditionals slow down page load?

I plan to implement some specific content for specific categories only, about 15. I wonder will wordpress conditionals (15 if) slow down my website visibly? Sorry if this sounds silly.
0
votes
1answer
113 views

Using in_category for non standard loops

Im using wp favorite posts to show a list of favorited post by a user on a page. It creates a loop of posts but I can't figure out how to use conditional tags for posts in the loop. Specifically for ...
0
votes
1answer
696 views

Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed

I have many custom post types, including some introduced by plugin such as bbPress or WooCommerce. My standard stylesheet is growing large, so I thought to split it into multiple stylesheets ...
1
vote
2answers
229 views

Change Site Title and Description html tags if not home page

For the purpose of good HTML structure, accessibility and SEO I'd like to change the site's title and description from H1 and H2 to P when appearing on any page other than the homepage. A conditional ...
-2
votes
2answers
460 views

Combining multiple conditional statements [closed]

I need a 3 part conditional statement with all negatives but I can't get it to work. I need to say that the post isnt in category 'videos' or its child categories and isn't from the author with the id ...
0
votes
2answers
649 views

If statement for is_author of a post

I want to show something in the sidebar of a post only if the author of the post equals a specific author or username. I was looking at is_author() but that doesn't seem to do the trick.
0
votes
1answer
190 views

How do I assign this filter to a variable? (Appending php & markup to the_content)

===I HAVE SOMETHING THAT WORKS NOW, JUST NOT CORRECTLY. PLEASE READ THE WHOLE POST, I AM GOING TO LEAVE IT ALL UP HERE BECAUSE OTHERS MAY BE ABLE TO BENEFIT FROM ME BUMBLING THROUGH THIS PROCESS!! I ...
0
votes
1answer
154 views

marking a post that was sticky on category template

i want some how to mark the post that has been featured (was a sticky post) in the category template. in wordpress logic it should be something like - was_sticky(); anybody?
0
votes
1answer
291 views

Hide Slider on Post Type Page

If users enter a code on the homepage and that code is valid they will be sent to a post type page where a profile is shown. The issue is that somehow the homepage slider is shown on that profile page ...
0
votes
2answers
474 views

Conditional tags to differentiate between profiles and activity with buddypress [closed]

I can't get any help on the buddypress forums so I'm going to ask it here. I'm trying to use conditional tags so I can have a different sidebar for the profile page than the activity page. For some ...
0
votes
1answer
103 views

conditional statement for profile pages

I'm using different headers for in my wordpress/buddypress setup and I need a conditional statement for member pages. So everything that comes after mysite.com/members/. How do I do that with ...
1
vote
2answers
536 views

Conditionally loading Facebook PHP SDK in shortcode

Since 3.3 we can enqueue scripts conditionally right in our shortcode functions, but when I tried to do this with some PHP class (uses session_start() in the __construct() function) as you can guess ...
0
votes
1answer
369 views

Custom Headers on Blog Posts Page

So I have created my own template that has a set header for all of my pages home (which is a static front page), about, services, contact, etc.... I have recently created two newer pages products and ...
1
vote
1answer
142 views

Conditional Facebook Share and Like links [closed]

I am using Simple Facebook Connect, and have enabled "Recommend" and "Send" links. Unfortunately they are appearing in too many places. Can I limit their appearance using is_category('catttttt') ...
1
vote
2answers
417 views

Register widget only page is a singular of custom post type

I've made a custom post type, with a few accompanying widgets, and I was wondering if it is possible to show (some of) these widgets only if you're on a specific page. Currently I've got function ...
1
vote
1answer
250 views

is_front_page not working at all in any of the themes .php files

I am using the Paragrams theme from the kind folks at wpshower. I have a little different front page that I would like to load with an image rotator and different layout in the for loop. I have tried ...
0
votes
1answer
375 views

is_page() or is_single not working

Im trying to clean up my scripts and I'm using a function to but ran into a problem with using both !is_page or !is_single to only show certain scripts on singles and pages. What did I do wrong here. ...
0
votes
2answers
135 views

Is there any way to assign stylesheets to whole sets of pages using is_page( )

The code below allow me to use a different CSS style to any page I declare <body<?php if ( is_page(array('page1', 'page2', 'page3'))) { echo ' class="myclass" '; } ?>> for example I can ...