Articles of wp query

how to invoke wordpress API from other existing PHP system

We have our own php system, now we want to have a blog function. Because wordpress are widely used, so we decided to use it. And now I want to invoke wordpress’s function , for example wp_insert_user , how can I can do that ? Suppose my system is A and installed on /var/www/A, and […]

Get posts by list of post IDs ordered by those IDs?

I am going to make a “favourite” posts box, but the article id‘s are stored in another DB so I only get an array of IDs (which are relevant to the WP DB). I think it could be done with get_posts() or simply just with WP_Query, however as I am surfing through the codex I […]

Custom wp_query time filter on meta_value

My goal is to only show posts with opening hours after business hours, for a given day. So, e.g. I have a (custom) post with following meta_key and meta_value: meta_key = ‘monday, meta_value = ’14:00 – 22:00’ The business hours are fixed: ’08:00 – 18:00′ I’d like to add a filter to my custom wp_query. […]

Query all posts if multiple meta key don't exist

I’m trying to get all posts that don’t have a meta ket that starts with aa_. I can do it this way $args = array( ‘posts_per_page’ => -1, ‘category__in’ => 23, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘aa_article_1’, ‘compare’ => ‘NOT EXISTS’, ‘value’ => ” ), array( ‘key’ => ‘aa_article_2’, ‘compare’ => […]

How to get all tags of a custom post type by id

simple question, how to get all tags of a custom post type by id? post_type=product. i have tried with in my post loop and the print_r returning me nothing. hence i tried this, $term_list = wp_get_post_terms($post->ID, ‘product_tag’, array(“fields” => “all”)); print_r($term_list); and it’s getting me tags in my print_r($term_list); Thanks

Prevent WordPress from loading comments

I’m displaying the comments for a post my way, using $comm = get_comments() and then passing $comm to wp_list_comments() (this is the reason why). How to disable WordPress from loading comments from the database into $wp_query, when the comment template is being displayed ? I’m asking this because I want to avoid this extra database […]

Query Custom Post Types & category_name?

I’m using jQuery Supersized to create a full screen image slideshow. The images are called from a custom post type called Slides. The code works fine but I want to be able to only pull in Slides in a specific category and for some reason I can’t get this to work. I’ve tried adding ‘&category_name=’ […]

custom post type search by reference id

I have a custom content type of tab_content with a relationship to a page. In my current script I have the id of a page and I want to do a query that will list all the children of type tab_content that have the relationship of a page with the specified id. All I have […]

pagination not working for category.php (custom post types in categories)

it works everywhere on my site but it isnt working in category.php. When i click page to it goes to… by the way this is showing custom post types within certain categories (no actual plain ‘posts’) But when the page loads its just the 404 page? When i go to /page/1 it works fine, […]

WordPress ignoring LIMIT / posts_per_page despite being in wp_query

Using WP query: $myquery = new WP_Query( array( ‘posts_per_page’ => $instance[‘count’], ‘meta_key’ => ‘mywp_post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’ ) ); Let’s get the request: echo $myquery->request; It returns: SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id ) WHERE 1=1 AND wp_posts.post_type = ‘post’ AND ( wp_posts.post_status = ‘publish’ […]