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

learn more… | top users | synonyms

0
votes
1answer
145 views

Remove CSS & JS files from Wordpress Main Page For Increase Pagespeed?

With the reference of http://stackoverflow.com/questions/12463304/wordpress-load-plugin-css-js-in-functions-php-w-conditional-tags answered by @maiorano84 i am using cforms, FancyBox, WP Page ...
0
votes
1answer
45 views

how to show this part only in the single post page?

I have this part in my index-meta.php file : <ul> <li class="Source"><a>source:</a></li> ...
1
vote
1answer
79 views

custom comments on specific post type

I have a custom post type called debate and I want to create some custom fields just on this post type. So, I have this code: function debate_comment_fields( $fields ) { if( is_singular( ...
0
votes
0answers
139 views

Different types of quantities (Weight - kgs, units)

I'm developing a shop that sells meat, poultry and similar items. From the knowledge I've picked up on the internet I understand that the best way of working with products that are purchased by ...
0
votes
3answers
77 views

Conditional Statements

I have created Custom Post Type called - listing Also created custom taxonomy - listingcategories In listing categories, i have created two categories music 2. features Now i want to create a ...
0
votes
3answers
76 views

Conditional tags not working

I'd like to display some CSS only for this page. In the theme's header.php, I have tried both: <?php if(is_page('events')) { ?> <style> #main { background-image: none; } ...
0
votes
0answers
98 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
1answer
284 views

is_active_sidebar() Always Returns False

I've never gotten is_active_sidebar() to work, no matter if there's widgets in the sidebar or not I always get false returned. Currently I'm creating a sidebar for each top level page: ...
0
votes
2answers
41 views

Conditional Tag for sub cagtegories?

We have is_category() for categories, however I m not getting a conditional tags for subcategories, I want to enqueue script only on subcategories but on the parent. So lets say I have a parent ...
0
votes
4answers
105 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 ...
0
votes
1answer
69 views

conditional tags for the output of a plugin

I'm still quite a newbie developer so small problems like this bring me to a stand still from time to time. I've basically built a custom plugin to display pdf images next to a link very basic I ...
0
votes
3answers
95 views

Conditional for Post Format

I want to to show a specific content on the top of each post (on single page) depending of the post-type. If it's normal, show something, if it's gallery, show another. By now the code is like this: ...
0
votes
1answer
446 views

is_home() not working in functions.php file

I'm using woo themes and trying to use some woo hooks to hook into the index.php file from my child theme. I'm using the following code: function content_woo_main_before() { if (is_home() || ...
0
votes
3answers
95 views

Only show content if current page is NOT one of 2 page templates [closed]

I've been using this if conditional statement to only show content if the current page is NOT using a certain page template; if (! is_page_template('template-custom.php')) { <!-- show some ...
0
votes
1answer
283 views

Limit Contact Form 7 hook to specific form

I'm using a Contact Form 7 filter to take action after the email is sent. How can I limit this action to only one form? There are multiple forms on different pages, and I don't want this action to run ...
0
votes
0answers
39 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
67 views

how I can show tag cloud for specific product category?

In woocommerce plugin, how I can list tags according to product category in a widget? for example I want to show laptop's tags in sidebar when user going to laptop products category. Thanks
0
votes
0answers
226 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
1answer
65 views

Removing template part when not on homepage if / else

Thank you in advance for any help! What I am trying to do is remove a template part from my home page after the user clicks on the pagination links from the posts, right now my template part serves as ...
1
vote
1answer
107 views

Adding conditional content to single post-type template

I have a new custom post type set up that will be where an online copy of our email newsletter lives, like any web-based archive of newsletters. I am trying to create a conditional statement to add ...
0
votes
1answer
26 views

Show content if page is a grandchild of top level page

I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy; - Top Level Page - Child Page - Grandchild Page ...
0
votes
2answers
260 views

Loading Scripts For Specific Template

I'm attempting to load a couple of scripts based on the template in use. However, the is_page_template is not activating. From my functions.php in the child theme I have: function sectionDescription ...
0
votes
3answers
184 views

Get template part based on custom taxonomy term

I have a custom post type and I'm trying to call up different variations of the navigation based on the custom taxonomy slug. I've done this fairly easily with normal posts, like so: <?php ...
0
votes
2answers
243 views

If is_single in functions.php

I want the remove wpautop filter working only on posts from my blog. Because at some pages i need the autop, and at some pages i need it to not be there. I use the following rule and it is in my ...
-1
votes
1answer
55 views

Using Conditional Tags to restrict something to 1 user?

I am using the following widget http://wordpress.org/plugins/widget-logic/ This allows me to restrict widgets using WP Conditional tags. What I want is to restrict one widget to only 2 users. ...
0
votes
1answer
47 views

Checking for 'gallery' shortcode using strpos always returns false

I want to conditionally enqueue a script and stylesheet depending on whether the [gallery] shortcode is used in posts. Here is how I am doing it (based on): function doraemon_scripts() { if( ...
0
votes
2answers
188 views

Don't show certain div on front page?

I have CSS issues with a certain div only on the front page (front-page.php). As I can't fix it, I was thinking about removing the item, but only on the front-page. I'm not exactly sure how I have to ...
0
votes
1answer
56 views

Variable Not Working Inside is_author() Array

I'm using a plugin (User Groups) to separate out users into, well, groups, and I need to figure out a way to create a conditional to check if an author is in a certain group. So, using get_term_by and ...
0
votes
1answer
100 views

What is the condition to check if we are in admin or frontend?

What is the condition to check if we are in admin or frontend? I want to add_action not in backend, but only in frontend.
0
votes
1answer
368 views

conditional statement for custom taxonomy

Struggling to find out how to achieve this, if it is at all possible. The equivalent of is_category but for a custom taxonomy I've set up. The taxonomy category if which being Taxonomy Name with 2 ...
0
votes
0answers
21 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 ...
-1
votes
2answers
40 views

Can't seem to get an else statement correct? [closed]

I'm learning my ways in PHP lately and play allot with WP and PHP. I've created a some PHP that fetches some posts with the same 1th tag. This with some help with a tutorial here and there. The thing ...
0
votes
1answer
638 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 ...
1
vote
2answers
365 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
1answer
224 views

How to check if post has any tag?

I am displaying post tags like this: <div class="tags"><?php the_tags('<span>Tags</span>' , ' '); ?> </div> It works fine, but if the post does not have any tag, then ...
1
vote
1answer
329 views

Conditional statement for parent, child and grandchild pages

I'm trying to figure out how to set up a conditional statement to check if the parent, child or grandchild is being displayed. This is what I've got so far: <?php if ( is_page( 'about' ) || '29' ...
0
votes
1answer
237 views

advanced custom fields: repeater field within conditional statement

I'm trying to figure out if it's possible to have a custom field within a conditional statement. e.g— if ( is_page( 'about' ) || '29' == $post->post_parent ) { //custom field goes ...
0
votes
1answer
39 views

conditional: if is page, and all subpages

What I'm currently trying to achieve is displaying certain menus on certain pages using one template and conditional statements, like so: if (is_page('donate')){ wp_nav_menu(array( 'menu' ...
0
votes
1answer
52 views

Is there a reason I cannot get the current category in a loop?

I think I am doing this wrong but if I do: if(have_posts()){ $category_id = get_query_var('cat'); var_dump($category_id); while (have_posts()){ the_post(); } } the var dump ...
0
votes
2answers
24 views

Why might conditionals not work on a page?

<?php if (is_single()) { echo '1'; } elseif ( is_page() ) { echo '2'; } else { echo '3'; } ?> I put this snippet at the top of index.php, which is what I'm using to govern the ...
0
votes
1answer
330 views

If custom taxonomy else conditional [closed]

I have a menu that I only want to show on certain pages using the following code: <?php if ( is_front_page() || is_archive() || is_404() ) { } else { if ( function_exists('has_parent') ) { ...
0
votes
1answer
198 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
2answers
54 views

Php markup question: php/html within conditional bit

I'm getting very confused trying to get an existing bit of code to work within a conditional if/else bit of code. I can't get the syntax correct. All the echo commas and semi colons (sorry I'm not a ...
0
votes
1answer
230 views

WooCommerce - Conditional loading different header & nav based on product category

All I'm trying to do is conditionally load different items in the header, or, if need be, a different header (header-this_category.php or whatever) for single products in a certain category. I know I ...
0
votes
3answers
164 views

static landing page leading to author specific pages w/ “live” content

My site has a static landing page with buttons to go to Cait's content or Shannons's content. Each author's page will feature their own posts, as well as a section with their social media streams. It ...
0
votes
0answers
60 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
2answers
585 views

Disable CSS for IE 8 and earlier.

I am trying to find a way to disable the twenty twelve stylesheet for anything in IE 8 or less. Is there a conditional code that I can put in my functions php file that will enable the default ...
0
votes
2answers
351 views

Set conditional on template based on referring page slug

I have a portion of a page template that is conditional upon the following elseif <?php elseif( isset( $wp_query->query_vars['details'] ) && $wp_query->query_vars['details'] == ...
0
votes
1answer
48 views

How to get type of archive whether it is post or date or category archive?

using function is_archive() we can know whether it is archive page or not. But if it is archive page how can i find whether it is author archive page or category archive or date archive. I have ...
1
vote
2answers
172 views

Output 2 items within the Loop

I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one? // 5 list items ...