How to Make my Homepage Display a Single Specific Post?

The simplest way is to go to Settings > Reading and choose “Your homepage displays” – “a static page.” That will give you a dropdown so you can choose the specific WP Page you want to display. Other options include creating a child theme or a custom theme, or in functions.php using pre_get_posts() to modify … Read more

Related Customs posts

P.S. In this project I use ONLY the same custom post type. No simple posts and other. Just “custom_post_name” customs posts. Nothing else. I am trying to make it work about few weeks. Please help me. As I understand I need only a good query and that is it. I am very beginner in WP.

Get queried object for custom post type count

function wpse340250_term_count( WP_Term $term, $post_type) { $q_args = [ ‘post_type’ => $post_type, ‘nopaging’ => true, // no limit, pagination ‘fields’ => ‘ids’, // only return post id’s instead of full WP_Post objects will speed up ‘tax_query’ => array( array( ‘taxonomy’ => $term->taxonomy, ‘field’ => ‘term_id’, ‘terms’ => $term->term_id, ), ), ]; $term_count = get_posts($q_args); return … Read more

query posts with selected post ids first

I’m not sure if it’s possible to do this in a single query in WordPress. You could potentially split it into two like below: <ul> <?php global $post; // Get posts by selected post ids $args = array( ‘posts_per_page’ => -1, ‘post__in’ => [12345,12543], ‘orderby’ => ‘post__in’ ); $myposts = get_posts($args); foreach ($myposts as $post) … Read more