Linked Questions

3
votes
1answer
2k views

WP_Query vs get_posts

I have read a number of questions on SE regarding these but I still can't figure the exact difference wrt usage. Would it be true to say that I would probably use WP_Query for the majority of ...
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){ ...
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 ...
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( ...
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
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 ...
0
votes
2answers
3k 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 ...
5
votes
2answers
946 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
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 ...
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. ...
2
votes
1answer
2k views

Wordpress Pagination Not Working - Always Showing First Pages Content

I am working on a website where I have a blog but I also have a custom post type to allow me to drop in some videos. I would like to use pagination so that if there are more then 9 videos displayed, ...
1
vote
1answer
3k views

How to display related posts from same category?

Is it possible to display related posts from same category as the current post?
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 ...
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
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) : ...

15 30 50 per page