Query_post 5 post first / last of post_id

Here I’ve written a function for you. It will return you an array of posts. You need to use is as wpse_243452_get_posts_by_ids( 50, 5, false ) if you need to get next X posts then just pass the second parameter as the integer number how many posts you need and then pass true. If you … Read more

Pull posts from all categories if quantity is not met?

I would start by creating an array to put your posts into, to create a counting system of some kind. Dump your list item output into that array, count it, and use the remaining count to call your second query. <?php $term = get_term_by(‘slug’, get_query_var(‘term’), get_query_var(‘taxonomy’)); $sticky = get_option(‘sticky_posts’); // Moved the base arguments into … Read more

wp_remote_post and form post

wp_remote_get returns a json string. You have different function to work with this json response. wp_remote_head() wp_remote_retrieve_body(), wp_remote_retrieve_header(), wp_remote_retrieve_headers(), wp_remote_retrieve_response_code(), wp_remote_retrieve_response_message() The example from the codex: $response = wp_remote_get( ‘http://www.example.com/index.html’ ); if( is_array($response) ) { $header = $response[‘headers’]; // array of http header lines $body = $response[‘body’]; // use the content } Depending on the … Read more

Blog posts not displaying on blog posts page

Your index.php is calling a template part (template-content/content-blog.php), which logically should contain the post content, but it’s commented out. Change: <?php //get_template_part( ‘template-content/content’, ‘blog’ ); ?> To This: <?php get_template_part( ‘template-content/content’, ‘blog’ ); ?> See if that helps.

Pagination not working on my archive page for a custom post type

So I got this to work by adding this function to functions.php // Custom query for events function set_posts_per_page_for_events_cpt( $query ) { if ( !is_admin() && $query->is_main_query() && is_post_type_archive( ‘events’ ) ) { // set date $currentdate = date(“Y-m-d”,mktime(0,0,0,date(“m”),date(“d”),date(“Y”))); $meta_query = array( array( ‘key’=>’event_date’, ‘compare’ => ‘>=’, ‘value’=> $currentdate, ‘type’ => ‘DATE’, ), ); $query->set(‘meta_query’, … Read more