Public query vars are those available and usable via a direct URL
query.
E.g.
example.net/?category_name=tech&tag=gadgets
But doesn’t example.net/?category_name=tech&tag=gadgets
show an archive? It definitely uses the archive.php
template, but for some reason, the is_archive();
conditional tag doesn’t seem to work.
If is_archive();
isn’t the conditional tag to check these archives with, what is?
Try this:
Yes, shows, (is_archive() returns true) however,
no, in this case, a
category.php
is used, if not found, thentag.php
and if any of those files,archive.php
displays your content.According to
template hierarchy
, in wordpress an archive is everything, that displays a couple of posts, then it is divided into a category archive, a tag archive, a date archiveâ¦EDIT
For this purpose are used is_category(), is_tag()⦠whole bunch of them
Conditional Tags