Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
get_posts() is a function for creating multiple loops. It retrieves a list of latest posts or posts matching criteria.
19
votes
Using get_posts with arguments found in meta keys
get_posts accepts any of the arguments that WP_Query accepts. So there's a few options.
1. meta_key and meta_value
<?php
get_posts(array(
// some more args here
'meta_key' => 'some_key',
…
16
votes
Accepted
get all posts ID from a category
The thing to remember about get_posts is that is uses a WP_Query object internally. get_posts source:
<?php
/**
* Retrieve list of latest posts or posts matching criteria.
*
* The defaults are as …
2
votes
Post count per (day/month/year) since blog began
Your best bet is probably to use $wpdb directly. You can use COUNT and GROUP BY to make things easier.
A query might look something like this:
<?php
global $wpdb;
$res = $wpdb->get_results("SELECT …