0
votes
2answers
56 views

If Month=Particular month display content [closed]

I want to use conditional tag to display content according to month. Such as if it is April, it should show something else something else. Right now I am using : <?php if(is_month() == '2' ) : ...
0
votes
2answers
30 views

PHP conditional script issue

I'm have the 2 seperate block of codes as shown below and the one below doesn't work except if I cut off the first one. Any ideas what the problem could be? Conditinal script <?php { ?> ...
0
votes
1answer
33 views

Php conditional help needed

I am trying to add conditionals for authorship to show for posts on a specific author id. Would appreciate if someone could give the following a quick look over <?php if is_author ('2') AND ( ...
1
vote
2answers
57 views

What is the correct way to write this conditional statement?

I'd like to remove auto formatting 'wpautop' from specific pages. Here is what I've got, but it doesn't appear to work: if ( is_page ( 'services' ) ) { remove_filter( 'the_content', 'wpautop' ); ...
-1
votes
1answer
435 views

Advanced Custom Fields | how to use conditional statements in repeatable group display [closed]

Hi there, I'm just getting started with ACF and writing php statements. Although I've been working with them for a little while I'm still building confidence. My aim To display a block of code if a ...
0
votes
3answers
118 views

Conditionally set post_content in wp_insert_post

Is it possible to conditionally set the post_content in wp_insert_post? Im using a foreach to add multiple pages at once: foreach ($create_pages as $new_page) { $add_pages = array( ...
0
votes
0answers
136 views

Wordpress custom metabox radio values using CMB

thanks for reading. Im using https://github.com/WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress to create custom metaboxes. I have created a radio metabox that looks like below. ...
0
votes
1answer
1k 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
1answer
726 views

Conditionally remove comments and post meta in functions.php

I'm new to Wordpress and am coming from the point and click world of Joomla! what was easy there now involves some solid php knowledge to replicate in Wordpress ;) I'm try to conditionally remove ...
1
vote
1answer
132 views

Add user settings to specific roles

Is it possible to do this? I already know about get current_user_can(), which does not work like I need. I'd like to be able to use an array if there are multiple roles. // Check roles to only add ...
0
votes
1answer
329 views

How to display conditional-content if wp_nav_menu( $args ) retruns something

I have a sidebar that displays child links of the current page (using this solotuin by http://wordpress.stackexchange.com/a/2809/27414) which works perfectly. If there is child links to be displayed ...
0
votes
1answer
928 views

Add class to DIV depending on page loaded

I'm designing a new theme and in my page template a have a section where an image is displayed . I would like this image to change depending on which page is loaded. The section is a DIV like this: ...
0
votes
1answer
230 views

Custom Meta Box If Else Statement

I have created a custom meta box for posts and I need to display said data. I have been using the below method to display the data, But I am in need of a slightly different solution. <a ...
0
votes
2answers
77 views

exclude custom post type from running a function

I have the following code in my functions.php file to display post shortlink in my posts (I prefer not to edit theme files if possible)... function add_post_content($content) { if ( is_single() ) ...
0
votes
2answers
114 views

Check IF single OR multiple custom data has been entered

I'm building a single template right now for a custom post type. I'm wondering if there is a way to check if either at least one or multiple of the custom values has been entered so I can display the ...
1
vote
2answers
527 views

Reordering Buddy Press profile navigation [closed]

I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use: ...
0
votes
1answer
50 views

include <p> content within conditional statement?

I have a gallery page wherein there are multiple individual galleries/sub-pages. I handle this function by using- <?php if( is_page( 39 ) ) { echo do_shortcode('[nggallery id=1]'); ...
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 ...
1
vote
2answers
319 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
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
361 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 ...
0
votes
2answers
128 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
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 ...