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

learn more… | top users | synonyms

1
vote
2answers
460 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
289 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
115 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
330 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
227 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
322 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
128 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 ...
0
votes
1answer
170 views

Conditional single.php statement not recognizing conditionals

I have tried every possible way of making this conditional work and it's skipping the in_category conditionals and going to the last option. This is my code in single.php: $post = $wp_query->post; ...
0
votes
1answer
272 views

TinyMCE Buttons on Certain Post Type

I'm creating a plugin that will allow users to create custom post types on the fly. On the new post types, I want a custom Button to show In the TinyMCE. Each of the post types has a unique ...
-1
votes
3answers
1k views

alt attributes not showing on pages

I have downloaded a wordpress theme called livepuse, and unfortunately the alt tags are not showing on portfolio pages for my images. The website is as follows: ...
4
votes
4answers
839 views

How to make plugin required in a wp theme without using php conditional statements when calling an individual function from that plugin?

One of my Wordpress themes requires a few third party plugins to run correctly. Most of the times I used to call functions from third party plugins using conditional statements like ...
0
votes
1answer
506 views

is_archive for custom tax archive page?

Having trouble getting the achieve page of a custom taxonomy to know its that page. It just shows the detail from the default is_archive blog page... This is what i've tried.. <?php } elseif ( ...
1
vote
1answer
107 views

Unexpected results with conditionals inside template part

Scenario: I have a template part loop-product.php which i am calling from home.php, taxonomy.php and a page template template-products.php. Inside that template part loop-product.php file i am setting ...
0
votes
4answers
1k views

WP newbie: using else/if statements to show multiple headers. bonks

This code is fine but if I try to copy the last 3 lines and add a new custom page with a new custom header class, it doesn't work. I just want to add 2 new pages to my WP site with different headers ...
0
votes
1answer
143 views

is_home() returns true while it shouldn't

I have a problem with is_home(). It is placed in my footer.php and it returns true when it shouldn't. I have a page template on which I perform a query with query_posts(). When I pass the following ...
2
votes
4answers
307 views

Conditional check for front-end which includes ajax

I need a conditional which exits if the context is not a front-end view including AJAX requests. I have this at the moment: if (is_admin() && !DOING_AJAX) return; The DOING_AJAX bit ...
0
votes
1answer
49 views

How to check via conditional tags for a single plugin page?

I am developing a plugin. To embed the stylesheet I used wp_enqueue_style(). I want the CSS file to be only implemented at the plugin's page. I have already seen solutions with conditional tags, but ...
0
votes
1answer
615 views

Why does this search.php not work?

This search.php shows all the results from a said search however, doesn't include the title, The Search Results For...... and search query amount; or even the no searches found and prints the ...
1
vote
2answers
528 views

Search Results: Differentiate posts and pages

Currently the search results are all shown in the same way, no matter if it's a post or a static page. As I don't want the comment count and the categories to show up for static pages, I was ...
2
votes
1answer
321 views

Problem with “conditional tag”: if empty

I've been trying for a while now to make it so that there is nothing shown if there are no Related Posts. Currently the headline and the container (of course empty) are displayed. Like I said I tried ...
0
votes
1answer
144 views

Comments and pingbacks issues

I've been trying to figure this out for many, many days now. I tried to modifiy the code various times, always with the same result. I just don't get it. I want to properly separate pingbacks and ...
1
vote
2answers
132 views

Trouble with parent and child conditional tag to show content

I am trying to conditionally change a link based on what page a user is on, but I am having trouble finding the correct code to perform the action. Here is what I want to do (In English to explain ...
1
vote
1answer
2k views

Conditional for single-{post-type}.php

Please help with this code for custom post type "video": If is single-video.php page { list custom-taxonomy of video. Example actors } Else { do nothing } I´m tried with is_single, ...
0
votes
1answer
76 views

Conditional tag-like function to tell if post is in trash?

What could I put in my theme to tell if a post is in the trash or not? For example: <?php if (is_trash) echo 'This post is in the trash!' ?>
0
votes
2answers
275 views

Conditional Tags and Echo HTML / divs or CSS and Display: none?

If I wanted to show a slider on the home page only, is it better or does it make a difference if I: use a PHP if/then statement and echo a division and markup, or use CSS along with a body class ...
1
vote
1answer
44 views

Is there a conditional tag to determine whether the post is _any_ custom post type?

We know you can do if ( is_singular( 'my-cpt' ) ) to test for a specific custom post type, but what about doing one thing if the post is a built-in post type, and another if it is not? Is it enough ...
0
votes
1answer
458 views

Conditional tags help (if none, don't display anything)

Although I've read several times through the Wordpress Codex, I have difficulties to do what I want. Actually this is for certain parts of my blog, so I guess once I figure out how to do it I can make ...
1
vote
1answer
441 views

IF.. post meta show… Conditional Tag Help…?

I have the following conditional tag, which a friend helped me with... Currently it works doing.. 1) If a featured image just show that. 2) If images attached show featured image wrapped in a link ...
1
vote
2answers
84 views

Same Conditionals Not Working on Two Different Hooks

Everyone! I am new to WP and trying to build a plugin. I have the following codes working properly: add_filter('the_content', 'say_hello'); function say_hello($content){ if(is_single() || ...
0
votes
1answer
427 views

functions.php and conditional tags

I'm having the following issue: some conditional tags do not work on the functions.php file. For example I'm trying to do the following: if ( is_home() ) : wp_enqueue_script('accordeon_setup', ...
3
votes
1answer
1k views

how to check if front page is set to show a static page

I need to determine whether the reading settings are set to use a static page or the latest post for the front page. Is there a conditional that will return true if the front page is set to show a ...
0
votes
1answer
256 views

Help with adding conditional title tags to header.php

From an SEO perspective, i'm trying to add conditional title tags to my WP theme such that it echos a piece of text based on various categories. Assuming that my category id's are 1, 2, 3, 4 Then ...
1
vote
1answer
300 views

is_page() conditional not working inside an AJAX function

I have a jQuery ui tabs that load posts via ajax on sidebar. Now in a specific page i want to filter the query post via is_page(); conditional. But in my case its not working. function ...
1
vote
2answers
1k views

functions.php conditional tag only for custom post type

I'm using gpp slideshow, which overwrites wordpress's default gallery display. I only want to use it on my custom post type, "listings" - how would I reference it to only replace wordpress's default ...
1
vote
3answers
634 views

Is there a way to check which template file is being loaded, if it is not a page template file?

I don't see any way of testing which template file is being loaded, if the template file is not a page template. Otherwise I would use is_page_template(). For instance, I am using a home.php template ...
0
votes
1answer
166 views

Conditional Tag Custom Querys?

I think thats what its called... Basically a conditional statement if there are any posts in a specific custom post type/custom taxonomy, show posts, it not show an img or include whatever…? But ...
0
votes
1answer
361 views

How to display a feature only if custom field value is set?

What i'm trying to do here is to modify the existing wp-postratings plugin. The function to display the ratings is: <?php if(function_exists('the_ratings')) { the_ratings(); } ?> However, the ...
2
votes
2answers
2k views

How To Remove The Author(s) From Certain Posts

There are certain posts on the website I'm developing, that don't need the author(s) by-line. (such as press releases) Is there any method, that allows me to remove the author (and co-authors) for ...
0
votes
1answer
874 views

using get_the_category to get all post categories except one

foreach((get_the_category()) as $cat) { if (!($cat->cat_name=='Featured')) echo $cat->cat_name . ' '; } this is what has been recommended in the forums but its not working for me. I need to ...
0
votes
1answer
210 views

Detect tag page and include an Image for that specific tag

I'm trying to figure out a way to include a div(which will contain a background image) for a specific tag. This block of code works but fails when a post has more than 1 tag. I'm using a page called ...
1
vote
2answers
1k views

Conditional Query of Custom Post Type and custom taxonomy

I am working on a project that has a custom post type called 'Experience Statement' Custom Taxonomy attached to that post type called 'Expertise' 6 different terms for the custom taxonomy: Coastal, ...
8
votes
1answer
2k views

Toggle admin metabox based upon chosen page template

I'd like to have a custom field interface show up only when a certain template is assigned to a particular WordPress page. Any ideas?
0
votes
2answers
112 views

Trying to use Ternary operators with WP Conditionals

Hi I am trying to use ternary operators with WordPress condtionals, using the code below, but it's giving me a PHP error, what am I doing wrong? echo is_home() : '1' ? '0';
0
votes
1answer
195 views

How to apply style to the body tag of a particular page?

I have the following code: <?php if ((is_home()) OR (!is_single()) OR (!is_page('171'))) : ?> <body> <?php else: ?> <body class="last-page"> <?php endif; ?> ...
1
vote
1answer
641 views

functions.php conditional tag - only show in single.php?

//Geo Map add_action( 'woo_post_inside_after', 'my_geo_mashup' ); function my_geo_mashup() { global $post; if ( in_category('listings') ) { echo GeoMashup::map(); } } Works to ...
0
votes
1answer
249 views

hard code shortcode only on specific category

I am looking to embed several shortcodes into my post template, but I want the tags to be conditional to a specific category (and subcats). I've looked through the codex, but I'm unsure where to ...
0
votes
2answers
620 views

Wrap the_title_attribute in a H2 within a Conditional Tag?

I have the following that works fine.. elseif( get_post_type($post->ID) == 'press' ){the_title_attribute();} However, i need the aforementioned title to be wrapped with a h2 tag. Tried this but ...
-1
votes
2answers
102 views

Delete backgound for ID with conditional if statement

how can I delete a background for #main only on my posts. I know that I have to create a conditional if statement in my functions.php file with if (is_post()) but I'm just not sure how to write it.
9
votes
1answer
4k views

Check if we're on the wp-login page?

How can I check if the current page is wp-login.php or wp-signup.php ? Are there more elegant solutions than using $_SERVER['REQUEST_URI'] ?
19
votes
6answers
46k views

If is custom post type

I am looking for a way to test if a post is a custom post type. For example, in say the sidebar I can put code like this: if( is_single()) { //code here } I want code were I could do ...