The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
372 views

Using PHP Increment and Conditional Statement to Alternate Loop Background

I'm trying to alternate the background on a theme page that is displaying a custom loop: $args = array( 'post-type' => 'portfolio', 'posts_per_page' => 10 ); $loop = new ...
0
votes
1answer
88 views

Problems with my conditionals in single.php by category

In my single.php file I would like to have a conditional that checks for the category of the post and display certain images and layout. Here is what I have: http://pastebin.com/dy6TE1yr
1
vote
1answer
100 views

Conditional Statement - Best Way to Remove Nav on Contact Page

I was thinking of removing navigation on my contact page. I was thinking of inserting a conditional statement and an inline CSS style to "display: none;" if the page template was the contact page. ...
0
votes
2answers
440 views

Dynamically output a class to an anchor tag depending on what tag is chosen

Not sure if this is possible, but what Id like to do is have the ability to output/add a class to an anchor tag depending on what tag I choose when creating the post. My reasoning behind this is to ...
0
votes
1answer
147 views

is_front_page breaks with url parameters generated by a plugin

I have a website that displays a specific layout feature only on the homepage, and this is working fine. However, the client has suggested that they would like the website to be bilingual, and so I ...
0
votes
2answers
494 views

Show image next to the comment author if have certain role

I want to create a badge image for comment author of a certain role, say, Editor. I want to style comments of users with the Editor role differently than comments of non-registered or lower-level ...
1
vote
2answers
2k views

is_front_page, is_page('slug'), is_page(id) not working

None of the following are working to display conditional format in the sidebar when the current page is the home page: is_front_page, is_page('home'), is_page(id) I added an else clause which is ...
0
votes
3answers
276 views

Conditional for Custom Post Types

I have a query that pulls custom post types and regular posts, but how could I tell it to offset just one post type in the query? My query: <?php query_posts( array( 'posts_per_page' => ...
1
vote
1answer
1k views

Need help on creating If-statement for custom meta fields

I'm using Wordpress. I have a movie review website called Filmblurb. For my blog posts, I'm trying to create posts with different categories. Under the "Reviews" category, I have a "Details" box that ...
1
vote
1answer
240 views

Conditional Shortcode image display

Got a problem with a shortcode.. i probebly dont know where & how to set the condition so it will display the right image according to the topic / category of the toturial.. Help Plz :) function ...
0
votes
1answer
124 views

Using conditional statements in place of custom Page templates

How do I use if/ else statements instead of custom Page templates? For example, I create content for static Pages that I want to look different from other static Pages. So instead of using ...
0
votes
2answers
1k views

Conditional Statement - check if post has an attachment image

I'm working on a conditional statement (in a loop) that looks for a featured image then grabs a default image if there is none, which I have figured out. But, I also wanted a way to pull the first ...
0
votes
1answer
42 views

Generating images from an array of categories

I'm using the following code to display images based on the category id: <?php if (is_category( 'web-design' )){ ?> <img src="<?php bloginfo('template_directory'); ...
0
votes
1answer
153 views

Date-Based Conditional Tag

I'd like to have a conditional tag that is something like this: <?php if (is_single()&&is_older_than_october_2011()){do this}; ?> The part I'm trying to highlight is the ...
3
votes
2answers
739 views

Display only certain posts based on visitor's country?

Is it theoretically possible to have the following feature? Each post has a country code. When a visitor comes in, the system will determine the visitor's country code. Then when the page renders, ...
0
votes
2answers
905 views

if/Else have_posts Else fails to echo message to page

Scenario: Page displays a list of titles for a custom post type (video) with a selected "category" (in the taxonomy its called the subject). For example videos with the subject of "creative" Problem ...
1
vote
2answers
462 views

Conditional custom field query

I'm working on a job board-type site, and the client want to sell featured posts. They want the featured posts to expire from showing up in the "featured" section after a predetermined period of time, ...
2
votes
1answer
372 views

Custom Menus, Widgets & Conditional Statements

I'm employing custom widgets for my client because it's easy and they have several menus they need to create specific to site sections. I then want to allow them to add to the custom menu dynamically ...
1
vote
2answers
173 views

to create own conditional tags for business directory in wp

i want to create conditional tags for the business directory categories as the conditional tags which are provided are for normal categories.which do not work for the business directory categories.can ...
1
vote
2answers
318 views

Conditional display for custom fields/taxonomy

If there's a value for the custom field, I want it to display the value. If there's no value for the custom field, I want it to display "N/A". I have this working for custom fields but cant replicate ...
0
votes
1answer
153 views

Message box when accessed from iPad

I am still looking for a solution for this and can't seem to find it. I have the following code to start, but am not sure how to write the function to fire off a .js file. I need this to work on one ...
0
votes
2answers
250 views

Check if has pages?

So hard to find this info... I'd like to know a way to find out if there are pages. Something like: if (has_pages()) { /* do something */ } I can't find a reference to any similar function... how ...
1
vote
3answers
953 views

How to show my sidebar in specific page only?

I would like to show a plugin in a specific page's sidebar only. For Example: I have the pages like .. home about us sub page 1 sub page 2 sub page 3 sub page 4 UPdate: i want to show, ...
0
votes
2answers
393 views

Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?

I have an IF statement shown below that runs one of 2 custom queries, based on the url. The problem I'm facing is if the url contains pagination such as /page/2/, my query breaks because the url isn't ...
1
vote
1answer
687 views

how to know if the post has pagination (<!--nextpage-->) or not

i need a solid solution for checking if a post has pagination or not, regardless of the number of current page in the pagination, and even if the post is in the first page of the pagination. the check ...
1
vote
4answers
4k views

Why isn't is_page working when I put it in the functions.php file?

I have page called "Apple", the page's ID id 2533. In page.php file I have line: echo $bannerimg And this function in functions.php: if ( is_page( '2533' ) ) { // also tested with ...
5
votes
7answers
5k views

wp_enqueue_script adding conditional statement not working

This is the code im using in my functions file: add_action('init', 'sort_out_jquery_pngfix_frontend'); function sort_out_jquery_pngfix_frontend() { global $wp_scripts; if(!is_admin()) { ...
0
votes
2answers
346 views

Conditonal statement for iPad

I need to hide the branding section of my blog, but only when someone is viewing it from the iPad. I am not sure how to attack this. EDIT: the function remove_access currently works in my template, ...
0
votes
1answer
1k views

If have posts a week old, display, else display a different loop

This is what I have. <?php $week = date('W'); $year = date('Y'); $projects_in_news = new WP_Query( array( 'post_type' =>'news', 'posts_per_page' ...
1
vote
1answer
921 views

Can shortcodes contain conditional statements? Even without them my shortcode renders blank page

The following code is supposed to allow for a shortcode that includes many attributes, but not all of the attributes may always be present in which case I do not want the containing element to show ...
1
vote
3answers
372 views

A function like is_page() but returns true if on any sub page of given page

In my header I use this code: if(is_page("stores")) { // Do something } I run some code if on the page stores but what I want to do is run that code if the page is stores or any page that is a ...
0
votes
1answer
112 views

Checking for custom field in admin pages

I am loading some scripts conditionally for the admin section with : if (is_admin()) { wp_register_style('admin_js', get_bloginfo('template_directory') . '/admin.js'); ...
0
votes
3answers
1k views

Hide a nav menu item based on get_user_meta results

I'm trying to hide a navigation menu item under certain circumstances. Specifically, if a user is logged in AND has already registered their product bar code, I want to hide the 'Register Kit' link ...
1
vote
1answer
1k views

Create a new usermeta field for users

How do I create a new usermeta field with a drop down selection values? Im want to create a conditional statement for all users with a certain value of the new custom field I want. For example, The ...
0
votes
2answers
358 views

Show label for value only when value exists, basic php

I currently have this, <?php $meta = get_post_meta(get_the_ID(), 'rw_agentPhone', true); echo "office:"; echo $meta; // if you want to show ?> Which is fine provided there is a value for ...
1
vote
1answer
86 views

WP for main site and two blogs - implementation

I'm working on an open-source software project and hoping to move and combine some disparate sites that it's on. Currently there is a main info/code site. Then there are two blogs for implementations ...
0
votes
2answers
125 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';
1
vote
2answers
607 views

wordpress is_page() problem

I want to load a .js file only on a specific page in Wordpress 3.1.2 So I use in functions.php function my_init_method() { if (is_page('myinfopage')){ echo "yeeessssssss"; ...
0
votes
1answer
211 views

Exclude a category from a query that includes its parent category

I am trying to use ids to control the structure of the output of my categories. I need to exclude a category that is part of the parent category that is being queried. What I am trying is : ...
1
vote
1answer
720 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 ...
2
votes
1answer
739 views

If function exists, and array is met, echo function?

I have a function like the following: <?php echo my_custom_function( array( 'category_url'=>'My Special Category' ) ); ?> It pulls data from the "My Special Category" and displays it. I ...
2
votes
7answers
8k views

Display navigation menu item conditionally based on user capabilities

I have one "branch" of my main site's navigation tree that should only be accessible to a set of registered, logged-in users. I understand how to query a user's role and capabilities. This question is ...
1
vote
2answers
125 views

can't use the page_test method to check pagination

I've tried to follow the example for Testing for paginated Pages but i don't know why it isn't working. i put it in the single.php file for post detection. i don't know why the page_test is broken. ...
2
votes
1answer
655 views

Conditional tag affecting taxonomy term and its children?

I am wondering how can I write a conditional tag that affects a custom taxonomy slug and its children? Found this in Wordpress Codex: is_tax( 'flavor', 'mild') When the archive page for the ...
4
votes
1answer
3k views

How can I determine if a post has an image attachment?

As far as I know, there's not a simple function that will return true if a post has an attachment. With that in mind, what's the best way to determine if a post has an attachment (or even better, has ...
0
votes
2answers
412 views

How do I test whether [gallery] is empty?

How do I test whether there are any images attached to a post? I'm using the gallery shortcode, but I want to put it in a conditional so the surrounding styling isn't displayed if the gallery is ...
0
votes
2answers
314 views

Conditional statement not working in function

Why doesnt this work ? I am trying to selectively load scripts but the second if statement is not loading them where it should. function my_init() { if (!is_admin()) { ...
1
vote
2answers
854 views

Function like in_category for custom taxonomies

I'm trying to display different content depending on the taxonomy that was been selected. For example I have a taxonomy named Type. Inside that taxonomy I have several different children, one is ...
3
votes
2answers
520 views

how to test for attached image

I am trying to find out whether or not a post has images. If it does, I then want to know if a featured image was specified for the thumbnail - if not, the get_thumb() function will assign an image ...
0
votes
1answer
139 views

Return count for characters in the comment and perform action based on the length

I am calling recent comments into my template with $comment->post_title the variable length is specified like this : SUBSTRING(comment_content,1,180) how could I write a conditional ...