How to make 10 post of one category

You can use pre_get_posts and is_category conditional tags to set posts_per_page to 10 for category pages. Here is a working exacmple function wpse_posts_cat_pages( $query ) { if ( $query->is_category() && $query->is_main_query() ) { $query->set( ‘posts_per_page’, ’10’ ); } } add_action( ‘pre_get_posts’, ‘wpse_posts_cat_pages’ ); What this code do: Check if it is the main query $query->is_main_query() … Read more

Highlight posts that belong to current sub category

Instead of: $categories = get_the_category(); $categories_id = $categories[0]->cat_ID; …use: $categories = wp_list_pluck( get_the_category(), ‘term_id’ ); Now you can correctly use in_array to search all the post’s categories, rather than just the first: if ( in_array( $thisTrueCat->term_id, $categories ) ) { … }

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