Before I start, you should not use capital letters in your names, and also, don’t use hyphens, the correct way is to separate words with underscores
What you are trying to do doesn’t work. Do a var_dump() to get the available query variables on your single page
?><pre><?php var_dump($wp_query->query_vars); ?></pre><?php
You will see that the following are invalid
$term_slug = get_query_var( 'the-art' );
$taxonomyName = get_query_var( 'art-category' );
I don’t know of any means to get the taxonomy from a term name, so this you will need to hardcode and you will also need to do a check to see if a post term belongs to the taxonomy.
To get the post terms, you can make use of one of the following
I would most probably also make use of a proper tax_query, the reason is, the way you are doing it will not work if you have more than one term.
Related Posts:
- $wp_query->queried_object->ID throws warning: Undefined property
- Select All in Parent Category, Group by Child Category?
- get_query_var() not working in pre_get_posts
- The Operator “NOT IN” Does Not Work In tax_query
- Counting Posts of a Given Post Type Having a Specific Taxonomy?
- How to get_queried_object on multiple objects?
- Displaying Posts Related to Other Posts by a Taxonomy Term?
- Sorting a list of posts displayed under a list of associated terms (which should be sorted without initial articles)
- How to get the parent’s taxonomy?
- Querying Posts by Taxonomy From Alternate Network Site
- Help with hierarchical custom taxonomies and permalinks…almost there
- custom post type paging not working past page 3
- Should unaltered default loop/query return a list of custom posts belonging to a custom taxonomy?
- Custom Taxonomy and tax_query Issue?
- Query for posts in 2 taxonomies
- Paginated Taxonomy Term Archive including one post per term
- Optimised Code for Pulling Taxonomy Posts
- Show Post Count of a Category
- WP_Query search posts by custom post type and custom taxonomy
- Is it possible to create a shortcode that will query a post based on taxonomies?
- Custom Post Type Loop within Shortcode
- Fetch taxonomies by custom post type id array
- Display CPT posts based on specific taxonomy
- shortcode to show custom post types by category
- Query/list all terms and their custom post count
- Filtering WP_Query Dynamically on the Front-End
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Genesis filterable portfolio isotope [closed]
- Get custom taxonomies from multiple posts
- Pagination for Custom Taxonomy Page [duplicate]
- Custom loop with multiple taxonomy queries
- Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?
- Custom taxonomy rewrite give pagination 404
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- How can I made custom taxonomies relationship?
- Custom taxonomies relationship
- How to have this permalink structure: post_type/postname/custom_inner_page
- First custom field value (out of several) displayed twice after query
- Add Custom Post Type of specific Custom Taxonomy to regularly blog loop
- WP_Query orderby and tax_query
- Retrieve custom post types by custom taxonomies with WP_Query
- WordPress wp_query() basic question about args
- Using page slug in wp_query
- Creating two loops based on different logic
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- WP_Query parameter conflict
- Different options per post type in WP_Query
- How to show all taxonomies within custom post type loop
- How to get the post terms from a child taxonomy
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- display posts of custom post type with custom taxonomy
- Exclude latest post from WP_Query taxonomy term loop
- How to query Posts from a custom post type which contains a custom taxonomy?
- Query Posts that have Custom Taxonomy
- List all Custom Post Type posts excluding certain Taxnomy term
- Foreach loop returning more than one item when querying taxonomy
- WP_Query order custom post type with certain meta key value by post modified date
- Cant’ Display Custom Post Type Title Base on Tax Terms
- Loop for custom-post-type comparing taxonomy terms for “related” posts?
- Display featured posts for a custom post type by taxonomy
- What is the most efficient way to execute recursive complex queries?
- Sorting the Loop by Taxonomy Value
- custom taxonomy pagination 404 error
- Ordering by meta value not working
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- custom post type and a “sticky” position taxonomy
- Display post count for a specific month
- display post count in archive page that have relation with another taxonomy term
- How to search through all child taxonomies using WP_Query?
- WP_Query for custom taxonomies showing posts from non-specified terms?
- Live search by custom tag
- Query a custom taxonomy in a function to create an csv file
- Ajax load more inside custom post type taxonomy
- Create a custom wp_query from a specific custom post type with specific taxonomy
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- Displaying WordPress posts from post and custom post type in custom taxonomy
- Get posts of an specific term of a custom taxonomy
- Checking Taxonomy Terms for a Custom Post Type With get_the_terms Not Working
- CPT Efficient way to display posts from different categories with custom query
- Query Pulling the same post twice
- WP_Query for CPT with filter by another WP_Query
- Get posts associated with custom taxonomy alternate way
- Loop with Custom Post Type and Taxonomies
- How to query posts by meta keys AND under specific category?
- Shortcode display CPT Query only showing 1 post?
- tax_query showing no results
- Values inside a custom field to determine which category posts to display
- How to display elements of different post types?
- Storing/querying custom date data
- Catergory args causing loop not to show
- Attaching multiple custom taxonomies to one CPT?
- Get X posts with the same terms as the current post (custom post type and custom taxonomy)
- Sort ACF by custom taxonomy
- Complex Custom Loop with Includes
- Query custom post type and group by taxonomy
- Dynamically count the number of custom post types associated to a custom taxonomy
- WP_Query not using relation key as expected and not producing any results
- WP Query filtering by custom category not showing all relevant posts
- Custom fields disappearing when a custom post type is assigned
- wp_insert_term how to insert “” in description