Top ↑ Display Text only on First Page of Archive Displays the default text, if neither was requested.If yes, it displays the second piece of text. Checks for category B if the user didn’t request category A.If yes, it displays the first piece of text. Checks to see if the visitor has requested Category A.This is some generic text to describe all other category pages, Instead, you can use conditional tags.Īgain, this code would be added before the loop: The archive.php template provides the most general form of control, providing a layout for all archives that is, a page that displays a list of posts.įor categories, WordPress looks for the category-.php files each with their own version of the text, but this would create lots of files in your theme. So you could format all posts in an animal taxonomy named news on a page that looks different from posts filtered in other categories. These files let you target specific taxonomies or specific taxonomy terms. (Note: post refers to any post type – posts, pages, custom post types, etc.). The category.php, tag.php, and taxonomy.php templates allow posts filtered by taxonomy to be treated differently from unfiltered posts or posts filtered by a different taxonomy. WordPress display posts in the order determined by the Template Hierarchy. This section explains how to use and create such templates. You can create optional template files to override and refine the index.php template files. When a visitor clicks on a hyperlink to category, tag or custom taxonomy, WordPress displays a page of posts in reverse chronological order filtered by that taxonomy.īy default, this page is generated using the index.php template file. Display Text only on First Page of Archive.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |