if the only difference in the category archives is the images, you can work without a custom query.
in this case you could use (as suggested here https://developer.wordpress.org/themes/functionality/pagination/#simple-pagination ):
<div class="nav-previous alignleft"><?php next_posts_link( 'Older posts' ); ?></div>
<div class="nav-next alignright"><?php previous_posts_link( 'Newer posts' ); ?></div>
or any other suggestion from https://developer.wordpress.org/themes/functionality/pagination/
for the image, you need to change the img
line in your category.php:
<h2><img src="https://wordpress.stackexchange.com/questions/360490/<?php bloginfo("template_directory'); if( is_category( 'black-metal') ) { echo '/assets/img/black-metal-h2.png" alt="Black Metal"'; } elseif( is_category( 'death-metal') ) { echo '/assets/img/death-metal-h2.png" alt="Death Metal"'; } ?>/></h2>
Related Posts:
- Get the children of the parent category
- wp_nav_menu not appearing for a couple pages
- Main menu not appearing on category pages
- Is it possible to put next and previous category links?
- Previous/next link to post in category, NOT tag?
- Multiple menu items highlighted
- wp_nav_menu not highlighting the current category when viewing a single post
- Open subcategories in submenu on click in primary menu
- How to display only posts assigned to a particular, isolated, subcategory
- Checkboxes in the category list?
- Restoring default article pagination on archives – Removing custom limits
- previous/next_post_link in the same sub-category?
- Create menu / submenu from category subcategory and posts
- How to display numbered pages in a category
- Give Children Unique ID’s
- Multiple categories for one menu item?
- Global navigation in multisite: problem with categories
- display specific category when website loads
- How to add all subcategories as submenu in WordPress menu
- Next and previous links category infinite loop
- omit categories from main navigation menu
- Loop within category’s posts
- Grouping parent categories into sections
- A simple question regarding tags and categories
- get_adjacent_post_link excluded_terms ignored
- Transfering static site to wordpress and retaining category by month paginations
- Post in multiple categories do not include in previous / next post if one category in excluded
- Get all first images of posts in same category
- Custom permalink structure leads to be 404 on pagination
- How to make child categories recognize parent’s template displays
- Completely disable categories
- Show div only if post is in specific category
- wp_list_categories exclude not working
- How to show a category post to a specific registered user
- How can I only show certain posts?
- Category menu item and its last 10 posts as sub-menu
- what is the action hook code to supporting product category condition in single product page of woocommerce?
- Prevent function from triggering again when post in specific category gets another category?
- Posts from multiblt categories but featured image only in the first one, the rest to have the post title only
- Conditional Tag for sub cagtegories?
- Display only posts from referred category on date archive page
- Sort post’s categories by ID
- in_category() not working in WordPress 4.9.7
- exclude post from displaying in loop if it is in a category, but not in many categories
- Show Featured products in product category pages
- How to remove category titles?
- Inserting Category programmatically
- Category-slug.php not being used
- Get only one of the current categories
- Show Available Taxonomy List with Current Category
- How to get grandparent of a given category
- Additional form options based on category selected not working
- Pagination for category slug returns 404 when page >= 2
- Display category-specific comments in sidebar
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Paging not working in category.php
- Display list of categories filtered by date?
- Remove the parent name from permalink
- Make parent category an optgroup
- Redirect single article permalink to paginated category page
- add slug beside name in Admin Category Checklists
- List only categories i specify
- Author Page – List of categories plus number of posts in that category
- On the Blogpost I have categories showing, is there a way to exclude a catgegory like ‘Media’?
- How can you access category information from a theme?
- Filter WooCommerce archive pages by an additional category
- Posts from a category on homepage with category archieves page default css
- How to use wp_list_categories with plugin category?
- Theme modification for custom category menus
- Custom css per category and per single post belong in each category
- How Do I Delete WordPress Posts Older Than 400 Days, From A WordPress Category
- Category Page Template – Can’t get category ID
- Subcategory is displayed before Parent Category
- Shortcode to display all the post from a category in a page
- Custom Loop with certain number of one category
- “Special” category is displayed in all categories or show parent category on sub category
- add woocommerce archive description if exist
- Can’t display posts by filtering categories using isotope.js
- Get a list of categories, separated by / to display inside the for custom metatags
- Is there a reason to put a product in both the Child and Parent Categories?
- Get_term_meta() always returns false
- How to list all categories a post is in, but exclude current post´s category on single post page
- Get only children category name
- Displaying only selected categories
- No results found for second level category
- get_the_category vs wp_get_post_categories
- How to get get_categories()’s ‘hide_empty’ argument to work with global year var in the archive template?
- Categories in media library
- WordPress Shop and restricting products and categories for some users/groups
- Pass list of categories to JS
- WP url to get rss with full text of post
- WP_query exclude a category unless it has more than one catagory
- Paginating a list of all posts collected by category titles
- Customize category query in widget
- Page permalink rewrite
- Broken category styling
- get_category_children/ the new get_term_children not work
- wp_list_categories() not listing categories
- List the category tree of all the product_cat categories
- Is there a function to modify existing previous/next post link without modifying theme files?