0
votes
0answers
26 views

How to display only the posts with category that match the current page URL

I'm trying to get the loop below to display only the posts with the name that matches the current page's absolute name. E.G: if the URL of the current page is mysite.com/current, then the post to be ...
-1
votes
0answers
35 views

How To Display Categories Conditionally on “The Loop”

I'm trying to get specific categories to display, and only when a given page is displayed. I have tweaked the start of "The Loop" to look as shown below but it doesn't work. Any suggestions on how to ...
0
votes
2answers
33 views

Checking conditionals

We all know about the default WordPress post types, these being aside, gallery, status, chat and so on. any good theme should support all of them. In the case where a theme does support all of them, ...
0
votes
1answer
177 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
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 ...
3
votes
2answers
1k views

How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?

I would like to create a condition that checks to see if a post has a thumbail and if it does display it, otherwise display the first image in a post. I tried something like this in my loop.php but ...
1
vote
1answer
67 views

Check to see if specific loop has less than certain amount of posts

I'm looking for a way to check how many posts are returned by a specific loop. So if I have a loop like this.. <?php $featured_post_id = get_the_ID(); global $post; $args = array('cat' => ...
0
votes
2answers
325 views

Loop to pull content from parent element in custom post type [duplicate]

I created a hierarchical custom post type called "films." It is hierarchical so it can have children elements. I am using a conditional statement in my single-films.php to show different content for ...
0
votes
1answer
279 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
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
604 views

Can I create a loop with multiple post types and specify different $args for each post type?

I'd like to create a custom loop that includes all Post types: Post and Video. Then I'd like to specify to show all posts of the post type Video, but only show posts that are in the category ...