Tag Info

Hot answers tagged


Don't run a custom query to get the post count. This is already done by the main query. What you are doing is the same as eating the same piece of meat twice. :-) As said, the main query already return the amount of posts found via the $found_posts property. You can access and display it anywhere on a page as follows echo $wp_query->found_posts; This ...


Based on the answer by @jan-becker I build this snippet. This works for me: /* * Get the next/prev image id inside c-tax: my_snapshot_position_ctax */ function my_return_relative_attachment_id( $this_post_ID, $prev = true ) { global $post; // overwrite global $post variable $post = get_post( $this_post_ID ); // filter sql query to work ...

Only top voted, non community-wiki answers of a minimum length are eligible