Linked Questions

2
votes
2answers
1k views

“pre_get_posts” firing on every query

How can I change arguments for the main query only, and not affect other queries? add_filter('pre_get_posts', 'custom_post_count'); function custom_post_count($query){ ...
1
vote
2answers
2k views

Query for multiple post types does not work

I'd like my frontpage to display a list of my lastest blog posts merged with my latest "Products" custom post type posts. From the documentation i gather this should work: query_posts( ...
2
votes
1answer
1k views

Is it necessary to reset the query after using get_posts()?

Is it necessary to reset the query after using get_posts() ? I have been looking at this page and I don't see any reference to get_posts() ... I can't make it out for sure from this page either. I ...
0
votes
2answers
3k views

Exclude current post from loop

I have a custom post type for accessories. When you view the post it also shows related posts. It looks great, but it also shows the current post within related posts. Is there a way to exclude the ...
2
votes
2answers
3k views

List posts by category exclude current post

I'm trying to get a list of posts from one category, echo the title and the permalink of all posts on that category but exclude the permalink and the post name IF the current post is on that list. It ...
0
votes
3answers
4k views

Problems excluding a custom post-type from the loop

Morning all, I'm having some issues with excluding my custom post-type 'events' from my index.php loop for my Blog page. I simply want to display the posts from my actual Blog, which I assume come ...
2
votes
2answers
2k views

How to make multicheck for post/page meta box

Please help me understand how to make Multicheck type for metabox. Search for all internet and nothing. Thanks. UPDATE @Jan I have a headache from this function. I dont know whats wrong.I'm ...
5
votes
2answers
940 views

Differences Between WP_Query() and get_posts() for Querying Posts?

What are the differences between using WP_Query() and get_posts()? Which is better to use in what case and why?
0
votes
2answers
2k views

How to order posts by modified date without using 'query_posts'?

I have an example basic wordpress theme template here for you. First, please take a quick look at it to get an idea. <?php get_header(); ?> <div id="primary"> <div ...
0
votes
2answers
1k views

Am I using get_posts wrong?

I have <?php $folioPosts = get_posts(array('category_name' => 'portfolio', 'numberposts' => 3)); if ($folioPosts->have_posts()) : foreach ($folioPosts as $folioPost) : ...
0
votes
2answers
2k views

Displaying related posts in a custom post type by a custom taxonomy

I'm trying to display related posts by a custom taxonomy (product_tags) in a custom post type (products). The following code works, but it ignores posts_per_page. Any ideas? global ...
1
vote
1answer
2k views

How to display related posts from same category?

Is it possible to display related posts from same category as the current post?
3
votes
2answers
2k views

Archive by Year

After some searching I haven't been able to find a answer to what I'm trying to archive. I'm trying to set up an archive page with accordion panels that hide/show posts from a given year with links. ...
0
votes
2answers
2k views

Why this code causes infinite loop?

Hi all I have this template page which get the page's post and then a list of posts from the category news. <?php /* * Template Name: News & Info */ get_header(); ?> <div ...
0
votes
3answers
3k views

current-menu-item not added on page showing custom post type (rendered with archive template)

I have setup a custom post type called 'expertizeom' I have setup a page called "expertize" and added to my custom menu (site main nav). The page is rendered with an archive called ...

15 30 50 per page