Search/filter is for searching within text, while filtering by taxonomies is a feature built into WordPress core templates and database structure.
With WordPress Archive Pages
The easiest approach would be to use the archive pages for taxonomy terms which are auto-generated by WordPress.
See https://developer.ww.wp.xz.cn/themes/basics/template-hierarchy/ for template structure which applies to most themes.
Pods Auto Template option can also add content to most theme taxonomy term archive pages if they display an archive term description.
With Pods WHERE Filter
Another option would be use the WHERE option of a Pods Item list block or Pods shortcode to filter to a taxonomy ID or slug name defined in the URL.
Setup: add define( 'PODS_SHORTCODE_ALLOW_EVALUATE_TAGS', true ); to wp-config.php
List all posts assigned to a certain country, e.g., placed on the /reisen/ page:
[pods name="post" where="country.term_id = {@get.country}"]
<a href="{@permalink}">{@post_title}</a>
[/pods]
List all countries with links to filter on the /reisen/ page:
[pods name="country"]
<a href="/reisen/?country={@term_id}">{@name}</a>
[/pods]
Hi,
thanks for getting back to me about this. I found an “archive.php” in my theme – and I can copy it to a “taxonomy.php” in my child theme and then add stuff to it, so the output will change. But I am still not understanding how to modify the output to a template I created with pods.
Right now the part of the loop for the archive looks like this:
get_template_part( 'loops/loop', 'blog-' . siteorigin_setting( 'blog_archive_layout' ) );
I have a pod template called “Reise-Liste” which I would prefer as a loop. What do I change to make my template the default?
Thanks,
Astrid
See https://docs.pods.io/code/pods/template/
echo pods()->template( 'Reise-Liste' );
When passed no arguments, pods() should use the arguments of the current template. If not, see the examples for passing arguments for the pod_name/taxonomy_name as well as pagination.
See https://docs.pods.io/code/pods/find/ for options for $params as seen in the ->template() method examples.
echo pods()->template( 'Reise-Liste' );
This will only display the template ONCE. I need to display it in a LOOP for every item in the loop.
So I need to find how to change the last line of this code here:
/* Start the Loop */
while ( have_posts() ) {
the_post();
get_template_part( 'template-parts/content', get_post_format() );
If I use echo pods … then this will not fill in the content from the post custom type.
It should echo for the current global post object and global post type within the loop:
/* Start the Loop */
while ( have_posts() ) {
the_post();
echo pods()->template( 'Reise-Liste' );
}
If it does not, the long-form would be:
/* Start the Loop */
while ( have_posts() ) {
the_post();
echo pods( 'name_of_post_type', get_the_ID() )->template( 'Reise-Liste' );
}
ah yes – the long form works.
Any idea how I can sort the results randomly ?