If it is a category page, you can get the id of the current category by using get_category:
$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
EDIT: You could use the variable $cat_id
inside your query instead of ‘Bristol’ and it would pull the correct category for each page.
Related Posts:
- Posts in Multiple Columns and Rows with one single loop
- Custom post type loops with different page templates
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- Custom Post Type Taxonomies -Posts not showing in Category or Tag pages
- Main query not querying any posts in custom taxonomy template
- assign different templates to custom post type with homepage loop
- Assign a template to a custom post type when displayed by the main loop on the home page
- Create a custom taxonomy template that loops through child categories in term order?
- On click some element i want to use some template
- Accessing download link from the loop with WP Download Manager Pro
- Custom taxonomy template for custom fields loop [closed]
- get_permalink() of page the enclosing page not posts
- Load different template for CPT (in loop) in my plugin?
- How can I pull information from my loop and divide them seperately?
- How to create custom page templates with default page layout framework?
- WP Query with categories only shows one post and ignores the category
- What to and how to proceed with CPT to make DB small and efficient?
- Content vs Template on custom post
- Post ID randomly printing on page
- A custom post within a custom post
- How to use custom template files in deeper directory?
- Display Custom Taxonomy Alphabetically
- Full Custom Post Type List Organised by two Taxonomies
- Displaying Custom Posts on a Page
- WordPress Doesn’t Generate Taxonomy Archive
- Shortcode not working with post counter
- A case for Hierarchical Custom Posts
- Problem: wp_query outputs all images on site
- Get custom post type’s fields in a while loop as variables
- Custom taxonomy returns 404
- Custom Post Type within the Loop on Homepage (Page Template)
- The loop seems stuck to a single (now deleted) post
- Posts per row on archive page (custom post type)
- Filter widget outputs
- Adding Page Templates to post but it ignored it
- How do I know the ‘meta_key’ for ordering my custom post type
- Template for all categories of a custom post type?
- Custom Theme With Custom Loops
- Custom Post Types strange pagination problem
- Migrating a taxonomy’s tags to the native category
- Flush Rewrite Rules when new site is created on network
- Custom post type conditional in loop
- Listing all term items alphabetically / sorting loop
- WordPress custom taxonomy template not working
- Display related custom taxonomy posts in sidebar
- How can I get this request to use the Custom Post Type page template instead?
- pagination not working for category.php (custom post types in categories)
- Only show posts with date of today or in the future (i.e don’t show past posts)?
- How do I control the output of a custom post type in the loop?
- Display custom post type posts first, then default posts
- Custom Post Type Category Link
- How to specify a template for a path like http://example.com/something?
- Custom Post type category pages template and loop
- Custom templates for a specific category
- Archive for a Taxonomy of a Custom Post type
- Three Most Recent Posts, One Per Term
- Targeting custom post type
- Does WP have a global of $id?
- WordPress Loop if/else
- get_the_title() is returning results from previous loop
- Custom Post Loop pulling all custom posts, not just one
- Conditional for a Single Post That Belongs to a Category?
- Wrapping x posts in html without leaving empty html
- WP Query post__in not returning correct results
- Custom Post Type single.php template only shows the latest post
- Sort posts in loop by the WooCommerce Membership of the author
- Custom post type pages return 404 page?
- WordPress 3.9 not using custom template
- Including all post id’s of a custom post type into an array
- How to include custom post type posts on a page?
- 4 column-loop ordered alphabetically with entries grouped (and labeled) by their first letter
- Tag page only display 10 posts
- Template files for Custom Post Type and Taxonomy
- Set templates for custom post types
- How to Create Template File for Parent Page of Custom Post Type
- Custom post_type search pages
- How can I group posts by months and years?
- Pagination Error : Duplicate argument being outputted
- how to remove pages loading with the archive templates
- get_post_type is always post
- Multiple Custom Post Type queries, how to DRY it up
- Custon Content within WordPress Loop
- Trying to Create a PHP Variable for post_type that can be referenced Site Wide
- Bootstrap accordion looping through posts incorrectly
- Custom Empty Results page for my Custom Post Type
- Loop increase number
- Custom post type showing same Post on all Pages
- get_post_meta is not working inside shortcode
- Custom posts template page
- Using wp_query to modify the loop in index.php for a CPT
- the_post() is printing titles in page footer
- Loop through custom posts by taxonomy and display the titles in a list, it is repeating 8 times
- Custom WP_Query doesn’t display all posts
- How can I use archive-{post_type}.php theme template?
- Query & the_content() is showing in the header
- Create Array from custom post type to display a slider
- Move Genesis Single Page/Single Post Title
- get parent content inside child posts
- 3 random images from custom post type, each in a div with a diffrent class
- make permalink go to a custom single.php file