Yet another get_posts() in explicitly defined order problem

Instead, you should use WP_Query Something like so: $specific_order_pages_query_args = array( ‘post_type’ => ‘page’, ‘post__in’ => $ids, ‘orderby’ => ‘post__in’ ); $specific_order_pages_query = new WP_Query( $specific_order_pages_query_args ); WP_Query’s order value post__in is a special value to order by the supplied post__in ID’s See more under Order in WP_Query http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters

List all pages including archive

Yep, this is definitely possible. Grab your post types and insert them in $post_types to loop through every one of them to manually generate the archives and posts: <?php // post types of your choice $post_types = array( ‘page’, ‘work’, ‘people’ ); $wp_cats = array(); foreach ( $post_types as $post_type ) { $pages = get_pages( … Read more

Can’t get Category link inside get_posts

If you can add your code, It may help for everyone. By reading you question. By default normally that get_category_link is have to work. Just use global $post before your loop. If is not work. What you have to do is. Grab the category id using your @category variable. (you can use print_r($category); or var_dump($category); … Read more

Get all posts with a certain meta key, except for one with specific title

Unable to test this at the moment, but try something along these lines. Search all posts for your Post Name (Special title), grabbing the ID’s, then utilize post__not_in to exclude those IDs in get_posts. function getAllPostIdsTest(){ global $wpdb; $excluded_posts = $wpdb->get_results(“SELECT id FROM ” . $wpdb->posts . ” WHERE `post_title` LIKE ‘%”Special title”%’ && `post_type` … Read more

Custom Post type Query post is not working

As of @cybmeta word’s, I answered my question here. Thank you for all of your effort. In future, if someone comes to read this article, just remember, default arguments also affecting your results. So my final working code it. global $post, $paged, $current_user; get_currentuserinfo(); if(empty($paged)) $paged = 1; $args = array( ‘post_type’ => ‘tickets’, ‘post_author’ … Read more

wp json api – get posts by category

I solved the problem in a different way. First I extracted all the posts by including category name inside of it. Check the answer below. public function module_data() { global $json_api; $url = parse_url($_SERVER[‘REQUEST_URI’]); $defaults = array( ‘ignore_sticky_posts’ => true, ‘posts_per_page’ => -1, ‘order_by’ => ‘date’, ‘order’ => ‘ASC’ ); $query = wp_parse_args($url[‘query’]); unset($query[‘json’]); unset($query[‘post_status’]); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)