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

learn more… | top users | synonyms

1
vote
3answers
481 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
373 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
211 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
299 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
347 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
300 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
323 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
260 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
61 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
106 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
362 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
1k 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
97 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
102 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
665 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
225 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
414 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
589 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
176 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
152 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
280 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
450 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
95 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
515 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
348 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
132 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
386 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
246 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
360 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
132 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
177 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
317 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
2k 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: ...
5
votes
4answers
1k 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
620 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
108 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
151 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
382 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
51 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
689 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
641 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
357 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
154 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 ...