0
votes
1answer
46 views

Help with if else statement for separating content from image attachment

I am currently having some trouble executing the following. I would like to separate the image (wp_get_attachment_image) from the content (get_the_content) by using a conditional statement to display ...
0
votes
0answers
46 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
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
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
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
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 ...
0
votes
1answer
733 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
83 views

Only on single post page

I am using this code to show ad below single post but only if it is in specified category. Code is giving right out put but it is also showing up on archive pages. I just want to show on single post ...
-2
votes
1answer
142 views

Weird html output of single_cat_title - is not inside of the html element?

I'm displaying a single "featured" post at the top of the blog index page, and category pages. I'm using this conditional to display the category name of the category page if it is a category page, ...
0
votes
3answers
99 views

How do I add a nested conditional within an echo - to use a default image if there isn't one in the post?

I'm trying to add a conditional that will display a default image if the "image" field isn't populated... here's what I'm trying to work with: $args = array( 'posts_per_page' => 3, ...
0
votes
1answer
99 views

Conditional for a Single Post That Belongs to a Category?

I have categories like gaming and movies on my website and when a user visits any of these categories the content in the sidebar is displayed depending on the category they are in. So gaming content ...
0
votes
1answer
179 views

Exclude custom function content from certain pages

I have added a small custom function to display a little author bio blurb at the bottom of each blog entry in my functions.php file inside the current theme that I am using. So far so good, it is ...
0
votes
2answers
112 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
1answer
641 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 ...
19
votes
6answers
46k views

If is custom post type

I am looking for a way to test if a post is a custom post type. For example, in say the sidebar I can put code like this: if( is_single()) { //code here } I want code were I could do ...