standard query for taxonomy.php

Posted in: Newsmag
Post count: 17

Hi,

which WP_Query / args are used for the taxonomy.php?
I only can find the one in the datasource.php, but adding paramaters there doesn’t matter.

Please let me know if this one is used or if there’s another one.

Thanks.

Post count: 6535

Hi

The theme uses the WordPress default query for custom taxonomies which it’s made in loop.php file here: http://screencast.com/t/vGXPifsf31
The query from td_data_source.php affect only theme’s blocks, or the content from Visual Composer editor. To affect the content displayed by the loop you have to write a custom query. Depending where you want to display posts from custom taxonomy the file differs. You can make a new page template with a custom query where only posts from one or more taxonomy are displayed.
Please note that working with custom taxonomies in WordPress require good coding skills and also many customizations in theme files. Here I found some information which may help you in this regard:
https://codex.wordpress.org/Class_Reference/WP_Query
http://www.wpbeginner.com/wp-tutorials/create-custom-taxonomies-wordpress/
http://code.tutsplus.com/tutorials/taxonomy-archives-list-posts-by-taxonomys-terms–cms-20045

If you still need guidance on this or you’re not aware of the steps you need to take in this regard please consider hiring a developer or a freelancer to do this for you.

Thanks!

Post count: 17

Thanks Andrei,

is there a chance to hook in the template output?
When I setup a new query in a taxonomy-my_taxonomy.php file and call the loop.php it doesn’t work with my arguments.
Otherwise I have to rebuild alle the necessary output myself.
Of course I’m able to do that, but I like to use the existing code.

Thanks for a hint

Post count: 6535

Hi

If you keep the call to loop.php the query won’t be changed even if you set new arguments for it. To have your own custom query in taxonomy.php just remove the call to the loop and add your new query with your arguments.
Also you can create taxonomy_custom.php file and copy in it only the code related with the page layout. The query part will be a custom one. This can be done for testing purposes if you don’t want to alter the original file.

Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.