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

learn more… | top users | synonyms

0
votes
4answers
133 views

Function to echo (or display?) wordpress tags in the head section

I can't figure this out but I'm trying to echo the post Tags of the post in the <head> section. This code resides in the <head> section of the site. Basically I want the post tags to ...
1
vote
2answers
33 views

Conditional IF statement not returning true even though echo of $user->province is correct

I am having a problem with an if statement which I have now tested many times over. $user_query = new WP_User_Query( array( 'role' => 'Subscriber' ) ); if ( !empty( ...
1
vote
2answers
523 views

Conditional tag in Widget Logic for checking if top level page or if subpage

I'm using the Widget Logic plugin to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code). What I would like to do is only show a widget on child pages, not top ...
0
votes
2answers
31 views

Is this a bad approach to add conditional comments to wp_head?

Why people say this is a bad approach to add conditional comments to wp_head? For example: function add_ie_html5_shim () { echo '<!--[if lt IE 9]>'; echo '<script ...
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 ...
2
votes
1answer
122 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')): ?> ...
1
vote
1answer
163 views

Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms

I am using Isotope to filter posts on the fly from my archive pages. I have a Custom Post Type called "art". On the sidebar, I've created links to yearly archives on my sidebar, i.e. 2014, 2013, ...
1
vote
1answer
291 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
1answer
44 views

How can I hide the category term for posts with none set?

I'm trying to hide the word "Category:" from the metadata on the Twenty-Eleven theme's footer, when I don't have one set for a given post (sometimes I will manually remove the "Uncategorized" ...
0
votes
1answer
58 views

Need a conditional to test if title of parent page matches title of child page

In my main loop, I need to incorporate proper html markup into a conditional to test if title of parent page matches title of child page and do (or do not) display certain content. Default might be ...
0
votes
1answer
28 views

How to check if the current page's parent is one of 2 different ID's

I'm using this little snippet right now to check if the current page is the child of a particular page; $studies_parent = 5860; if ($studies_parent == $post->post_parent) { Which is working ...
0
votes
1answer
1k views

is_search not working on search results page

Having an extra submenu with this code in sidebar: <?php if(is_404() || is_search()) : ?> <?php echo 'zou leeg moeten zijn'; ?> <?php else : ?> <?php if($post->post_parent ...
0
votes
1answer
290 views

If tag exists and equals then

I have the following code and I'm trying to check to see if a specific tag exists and if so I need it to be echo'd once. The problem I'm having is when the tag exists multiple places it gets echo'd ...
0
votes
1answer
167 views

Custom Function for Portfolio Archive Template With Conditonal Tag

Can't work out which conditional tag to use to add a page title to the portfolio archive page which uses custom posts types. This doesn't work: if( is_archive('portfolio') ) echo '<div ...
0
votes
1answer
65 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 ...
0
votes
1answer
85 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
42 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
153 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 ...
0
votes
1answer
131 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 ...
0
votes
1answer
331 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 ...
1
vote
0answers
33 views

Adding Controls to Theme Customizer If Certain Page Template is Active

How to Conditionally add controls on Theme Customizer panel. Conditional like is_page() or is_page_template() obviously does/will not work because the page is being shown is customize.php. Code ...
1
vote
0answers
177 views

Auto Add Image Title,Caption,Alt Text,Description while uploading Images in WordPress

Can anyone tell me how to auto fill/add same image title in title, caption, alt text and description while uploading any image in my WordPress Posts.
1
vote
0answers
190 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 ...
0
votes
0answers
17 views

Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)

I am using this to load css styles in the admin area (for any user who is not an administrator): function wpse_admin_styles() { if ( !current_user_can( 'manage_options' ) ) { echo ...
0
votes
0answers
46 views

Conditional tag to check if 'page.php' is being used?

I'm trying to check whether the page.php template is being used or not. I've tried is_page_template( 'page.php' ) but it doesn't work. I also can't use is_page() because I only want to do something ...
0
votes
0answers
21 views

Issue getting gettext to work with conditional statements

I've been trying to apply a gettext filter to return two different results for different product categories (or read as categories for posts, non-woocommerce specific). I cant seem to get it right. ...
0
votes
0answers
39 views

Identify a Woocommerce page by Wordpress conditional tags

we have a website running on WPMU, and the main site is using Woo-commerce and the sub sites doesn't use that. I use conditional statement in my meta title with following code: <title> <?php ...
0
votes
0answers
29 views

is_admin() triggers error

I've a plugin which includes other files and it looks like that : if( is_admin() ) { require( DIR. 'file.php' ); } In this file I run a class. This class is initialized on plugins_loaded. ...
0
votes
0answers
8 views

Tag, Category and Single Conditionals

We have this sample: This function call Backgrounds in different places in the WP I add it to the <body> <?php function backgrounds(){ global $wp_query; if(is_home() || ...
0
votes
0answers
24 views

Conditional within a public function within a loop

I am using a plugin to build widgets that includes images. Unfortunately it doesn't allow me to resize the images. I tried by adding a conditional but since it's in a public function and within a ...
0
votes
0answers
46 views

conditionally display text - on nextGEN gallery pages only

I'd like to use functions.php to display some text via a hook on pages displaying a nextGEN gallery. I can't find any documentation for nextGEN code. something like: // add note to nextgen gallery ...
0
votes
0answers
25 views

Multiple Plugins Interacting with Menu

Got an issue with the use of multiple plugins interacting with the menu system in WordPress. We are using UberMenu and wanted to use If Menu as well to control the visibility of some of the menu ...
0
votes
0answers
61 views

Diffrent search templates for different post types

I have a site with diffrent post types. Two of them are the 'post' post type and the other one is 'charity', for both pages I have an index, the normal index.php and a diffrent page template for ...
0
votes
0answers
66 views

admin-ajax.php nulls all php variables

I have a problem in a custom function. The function which adds to the WHERE clause in Store Locator Pro works correctly on its own, but I only want it to only work on a certain page, not on all my ...
0
votes
0answers
21 views

Conditional to use 'full' image size with animated GIFs

I am using ACF and pulling images into my category archives via ‘wp_get_attachment_image_src’ like this: <?php $image = wp_get_attachment_image_src(get_field('image'), ‘grid’); ?> <img ...
0
votes
0answers
63 views

restrict access to specific urls on a specific period of time

I have a countdown timer plugin which is set do redirect the user to a specific permalink after the time is elapsed. I've added a countdown timer here : mywebsite.com/mypost which is set to 3 days ...
0
votes
0answers
67 views

Detect Page Template inside Loop possible?

I'm a bit stuck with my actual theme development. I'm using different Blog Templates to choose from. Now each of those Blog Page Templates has a custom loop to pull the posts. Inside that loop I use ...
0
votes
0answers
45 views

Change conditional tag in wordpress without editing the core files

In wp-admin/includes/class-wp-posts-list-table.php lines 59-69: if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { $exclude_states = get_post_stati( ...
0
votes
0answers
128 views

is_page() is not executed

I am making infinite scroll page. I created a page template where posts of certain category are loaded. Everything works fine with a single page and single category. But I have three pages with this ...
0
votes
0answers
54 views

Conditional before_widget and after_widget

Is it possible to use a custom before_widget and/or after_widget value for certain widgets? For example, I'd like to add a opening <div> tag before the first and closing </div> tag after ...
0
votes
0answers
323 views

is_home() and is_front_page() not working in sidebar

I'm trying to display a custom widget in the sidebar of my homepage (which is a static front page defined in Settings > Reading). Here is the relevant part of my sidebar.php: if ( is_front_page() ...
0
votes
0answers
22 views

Template is different with and without comments

My referenced website is at http://angelopardo.com/wakeupbeast and I've built it as a child theme of twentytwelve. Pages and single posts that have comments are displaying correctly, where the ...
0
votes
0answers
70 views

Conditional logic for the new 3.6 structured post formats

Currently i have couple of custom fields in a custom metabox for post format options, like link url, video embed code etc... This works fine in version 3.5 and below. Now, with the new soon to be ...
0
votes
0answers
92 views

Custom Post Query Combined with Conditional Tags

Is it possible to combine displaying a list of custom post types on a single page depending on conditional tags? Below is what I have so far, basically if there are 4 posts or less show the posts, if ...