Tell us what you are trying to do?
hidden link
I want to organize the default page of Character archive page by category.
If that is a View, then edit the View in question so to use what you need in the "Ordering" Settings of the View.
(See Screenshot).
This can however only be by native Post Data or Custom Fields.
To order Posts by their Taxonomy Term, you would create a Taxonomy View ordered by Term name, then, in that View Loop, insert the Post View that displays Posts by Terms set in the parent View.
On post Archives, this is not possible, because the archive itself already displays posts and cannot take a parent rule anymore (View that returns Taxonomy terms).
This is not a limitation of Toolset but native WordPress does not support ordering by taxonomy itself.
(This means, you cannot even do it with Custom Code hooked to pre_get_posts() using core WordPress API)
The only possible approach hence is either extensive Custom PHP code or doing it with a nested View as above shown instead of an Archive.
I like the design of the example you show very much, BTW.
that is post Archives page.
So if I am using PHP something like this example:
<?php
// global $post;
$args = array(
'post_type' => 'post',
'order' => 'DSC',
'posts_per_page' => 3);
$product_posts = get_posts( $args ); // returns an array of posts
?>
I know it is possible to manage the structure but I cannot embed this PHP because I am using toolset WP archive.
In this case, what should I do?
Thank you 🙂
Hello,
For the new question:
I cannot embed this PHP because I am using toolset WP archive.
I assume you are going to setup some custom parameters in the archive page query,
If it is, you can try WordPress built-in action hook "pre_get_posts":
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
Hello,
I would like to use "pre_get_posts" hook, but how to put custom PHP code to archive page if it was created via toolset archive editor (not via simple WordPress archive page)?
Thank you
There are lots of example in the document I mentioned above:
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts#Examples
Section "Examples"
You just need to put custom PHP codes into your theme file "functions.php"