Instead of checking against the template, you should use is_tax()
which is one of the conditional tags in WordPress.
So in your function, you just need to use is_tax( 'state' )
in place of is_page_template( 'taxonomy-state.php')
, and your asset would only be loaded on the archive page for your custom state
taxonomy.
Related Posts:
- Changing stylesheet depending on custom taxonomy terms
- Using wp_query is it possible to orderby taxonomy?
- custom post type taxonomy “tag” archive : no post found
- Get taxonomy names by post id
- Return only the custom sub-term for custom post type, do not echo term-parent
- Get total number of comments from posts in a specific custom taxonomy
- Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children
- How to add a style to taxonomy edit page
- Formating the_terms() function output
- Archive template for taxonomy terms
- Custom taxonomy on users with UI
- Post tags saving as both tag name & tag ID on post update when tags are displayed as checkboxes
- Looping Through Custom Tax Terms and Displaying All Posts For Each
- Taxonomy Relationships
- Combine multiple custom user taxonomy in single url
- Add custom taxonomy to default category taxonomy?
- Display sub-taxonomies based on SELECTED parent-taxonomy
- Checking if a Page has an Associated Term?
- What are terms and taxonomy, how they related to post and how these three are stored in database?
- Taxonomy , subtaxonomy,child taxonomy of a product woocommerce
- Get terms ordered by post date
- How to display custom taxonomy in multiple columns?
- How can I get WP to build a feed based on multiple taxonomy terms
- Change permalink of post if it belongs to custom taxonomy
- Get pages only with a specific taxonomy
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- Share taxonomy between user and posts?
- Displaying custom taxonomy terms active trail
- ACF vs Taxonomies
- How to filter terms from a custom taxonomy by a usermeta value on all screens and templates
- How to obtain the link/URL to the feed of a custom taxonomy?
- get_term_children doesn’t return an array of children terms
- Use get_the_terms to list subcategories of custom taxonomy
- Get taxonomy parent using child slug (from merged taxonomies)
- Styling Taxonomy Terms Individually
- Custom taxonomy [year] is directing to yearly archive
- Display Taxonomy Terms in an option tag with value being the slug
- Modify “View” in admin panel for custom taxonomy
- Hide product categories and taxonomy terms in menu if empty
- Custom taxonomy forms for user profile
- How to add Post Format Taxonomy Archive page in the menu?
- Query posts by taxonomy with current term
- get the taxonomies terms associated with users
- Add Taxonomy Subcategory To Permalink
- problem in taxonomy-{taxonomy}.php pagination
- Create custom taxonomy and Display in metabox dropdown
- Custom Taxonomy with tax_query
- Get posts in certain Taxonomy terms for the current page url
- How to add images to taxonomy terms? [duplicate]
- Why get_page_template() doesn’t show taxonomy template file name?
- Trying to add taxonomy to get_categories() but it’s not working. How to fix this?
- Edit custom taxonomy description programatically
- Get taxonomy name for the current post
- View the complete list of a taxonomy in the navigation menu
- Get name of taxonomies of current page
- Filter through custom taxonomy with an array of taxonomy IDs
- How to get attached image to taxonomy..?
- How to get list of only custom taxonomies?
- Add custom taxonomy as a css class
- Taxonomy page shows category in title
- Query custom taxonomy for category including children
- Taxonomy Overview Page?
- Only display latest custom taxonomy post
- How can I get Taxonomy Images to work with ‘orderby’ argument?
- Unable to get the Parent Custom Taxonomy Terms
- Unsetting post_tag taxonomy breaks term description for other taxonomies
- Taxonomies on Pages with Custom Formatting
- How to combine taxonomies into URL?
- Amend taxonomy to search in wordpress admin
- Unique taxonomy for post
- Prioritise Pages over Taxonomy Term Root Archive, but not Taxonomy Term Child Archives
- Add terms to a taxonomy archive from within the same taxonomy
- Show recent posts from a custom taxonomy in wordpress
- Fill New Taxonomies
- add pagination in wordpress page template
- how do you pull data from two taxonomies?
- problem : Custom taxonomy template not showing
- Custom dropdown list taxonomy not saved
- How to get all the terms from a custom hierarchical taxonomy via REST api?
- Filter “get_terms” query
- Get post meta value outside of the loop
- Unable to create a new taxonomy
- Change link of taxonomy when get_the_term_list( is used?
- generate random slug when adding taxonomy
- Custom taxonomy shows full articles
- How to add meta fields to custom taxonomy add/edit page?
- Change order custom taxonomy
- Register custom taxonomy from a Advenced custom field option page
- Using wp_query is it possible to orderby taxonomy?
- List of taxonomy archive index page links
- Custom Taxonomy Template Variables Available?
- Insert taxonomy term to different table
- Group custom taxonomies based on tags contained in their posts
- Prevent random entries in hierarchical false taxonomies
- Exporting CSV of users with custom user taxonomies out of WordPress
- Taxonomies starting with a hyphen (minus) to assign B.C. dates to a post
- is_tax not working for custom taxonomy
- Querying posts globally based on custom taxonomy with its own taxonomymeta table
- How to delete unused terms?
- Child terms with improper parent in the url should redirect to 404