Having Issues with in_category , need help

Welcome to this community Prezido. the_field() function has echo in it. There is no problem with in_category() function. You need to use get_field() function when you echo the values of fields. I’ve updated your code. This version should work as expected. <?php $post = $wp_query->post; if ( in_category( ‘5’ ) ) { echo ‘<table> <tr><td> … Read more

how to show all type of author posts in author page (SOLVED)

If you use WordPress author template to show user posts ( example.com/author/{user_name} ) the best solution will be to change the main query via the pre_get_posts filter hook. function se339534_author_any_post_types $query ) { // apply changes only for author archive page if ( ! is_author() || ! $query->is_main_query() ) return; $query->set(‘post_type’, ‘any’); } add_action( ‘pre_get_posts’, … Read more

post_count not working

post_count is not a parameter of WP_Query argument. post_count is a property used to get the number of posts being displayed. For example, echo $my_related_posts->post_count; will display the number of posts being displayed.

custom sort posts in archive/taxanomy page

Put something along these lines in your functions.php: add_filter( ‘pre_get_posts’, ‘custom_get_posts’ ); function custom_get_posts( $query ) { if( is_category() || is_archive() ) { $query->query_vars[‘orderby’] = ‘name’; $query->query_vars[‘order’] = ‘ASC’; } return $query; } reference here (see the second answer)