Hi @abiralneupane,
Thanks for your feedback.
We added an update in Starbox with the option to hook the Latest Posts query.
Here is an example you can add to the theme functions.php file:
add_filter('abh_author_latest_posts', function($query){
$args = array(
'post_type' => 'services',
'post_status' => 'publish',
'posts_per_page' => 5,
'orderby’ => 'title',
'order’ => 'ASC',
);
return new WP_Query( $args );
});
Hope this helps.
Calin
-
This reply was modified 10 months, 1 week ago by
Calin Vingan.
-
This reply was modified 10 months, 1 week ago by
Calin Vingan.
Hi Calin,
Thank you for adding this to the plugin.
One more thing, if you don’t mind, after you change the query using ‘abh_author_latest_posts’ there’s a code that fetches the category using ‘get_the_category()’. I believe this would only work if the post_type that WP_Query is querying is a ‘post’, For custom Taxonomy, I don’t beleive it would work.
Is there any way, we can have a flexibility to do that?
Also, we have updated the plugin into pro, but haven’t received any new update for this. Can you also update the pro version please?
Thank you again for the support
Best Regards
Abiral Neupane
Hi there,
Just following up on my last request.
When can we expect a new release for the pro version, with the changes that we had on the free version?
Thanks in advance
Best Regards
Abiral Neupane
Hi Abiral,
We’ll release soon an update with these hook on the PRO version.
I will let you know when it’s ready.
Calin
Hi Calin, I just remembered one thing.
The hook that you guys added “abh_author_latest_posts” gets triggered only after the query is run. The hook will replace the result of the query. So, if we need to override the query result, we need to run the query twice.
So, I think it will be better if there was a hook to modify the query arguments in the first place like this
$latest_posts = new WP_Query(
apply_filters('abh_author_latest_posts_args', array(
'posts_per_page' => ABH_Classes_Tools::getOption('anh_crt_posts'),
'author' => $this->author->ID
));
);
$latest_posts = apply_filters('abh_author_latest_posts', $latest_posts);
If some other themes or plugin uses this new hook, it will not affect the performance like it does if the ‘abh_author_latest_posts’ hook is used.
I hope you would consider this.
Thank you again for your kind co-operation.
Best
Abiral Neupane
We added the hook in the PRO version of the plugin too.
The last version of Starbox PRO is 1.7.0.
Best, Calin