Get posts by category or author

I used the following in my child theme ‘functions.php’ to get posts by category name. You can also use category ID number but that didn’t work for me. add_action(‘pre_get_posts’, ‘ad_filter_categories’); function ad_filter_categories($query) { if ($query->is_main_query() && is_home()) { $query->set(‘category_name’,’tips’); } }

How to remove related post from home page

Simply if(!is_home() && !is_front_page()) add_action( ‘thesis_hook_after_post’, ‘my_related_posts’ ); will do that for you. It will not do the add_action() when we are at the home page or not any front page. If it doesn’t work for you, may be you need to contact with the Thesis team.

Add category selection to function request

Instead of a sql query, I recommend to do it in wordpress way: $args = array( ‘numberposts’ => 3, ‘offset’ => 0, ‘category’ => put_your_category_id_here, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $request = wp_get_recent_posts( $args, ARRAY_A ); Reference : WordPress Update : here is the … Read more

Posts per page, reverse count

If you don’t mind the cost of calling COUNT to first get the total number of posts (you have a dynamic first page in terms of numbers of posts so it doesn’t work with a simple offset) here is something that I’ve wrote (it’s late and I am tired so it might have some bugs … Read more