Skip to main content
  • Home
  • WordPress Plugins
    • Ajax Load More Infinite scroll WordPress posts, pages and more
    • Block Manager Remove unwanted blocks and patterns from the Block Inserter
    • Easy Query Create a custom WordPress query in seconds
    • Instant Images Upload photos from Unsplash, Openverse, Pexels, and Pixabay directly to your media library
  • Blog
  • About
  • Account
  • Cart

Ajax Load More Logo

  • Ajax Load More
  • Add-ons
    • Cache
    • Call to Actions
    • Comments
    • Custom Repeaters
    • Elementor
    • Filters
    • Layouts
    • Next Page
    • Paging
    • Preloaded
    • Query Loop
    • Search Engine Optimization
    • Single Posts
    • Theme Repeaters
    • WooCommerce
    • Ajax Load More Pro Get instant access to all premium add-ons in a single installation
  • Extensions
    • Advanced Custom Fields
    • Relevanssi
    • REST API
    • SearchWP
    • Terms
    • Users
  • Examples
    • Default
    • Advanced Custom Fields
    • CSS Grid
    • Event Listing
    • Filtering
    • Images Loaded
    • Masonry
    • Multiple Instances
    • Preloaded Posts
    • Progress Bar
    • Search Results
    • WooCommerce
    • View All 30+ Ajax Load More usage examples
  • Docs
    • Add-ons
    • Archives
    • Callback Functions
    • Code Samples
    • FAQs
    • Filter Hooks
    • Implementation Guide
    • Implementation Methods
    • Loading Styles
    • Masonry
    • Parameters
    • Public JS Functions
    • Repeater Templates
    • Results Text
    • Screenshots
    • Shortcode Builder
    • Stylesheets (CSS)
    • Variables
  • Support
  • Download
DocumentationOnline documentation for Ajax Load More

Documentation

  • Add-ons
    • Cache
    • Filters
    • Next Page
    • Paging
    • Search Engine Optimization
    • Single Posts
    • Users
    • WooCommerce
  • Archives
  • Callback Functions
    • almComplete()
  • Code Samples
    • Author Archives
    • Category Archives
    • Custom Fields
    • Date Archives
    • Date Comparison
    • Date Query
    • Exclude Posts
    • Exclude Password Protected Posts
    • Loading via Ajax
    • Order by Meta Key with Meta Query
    • Ordering by Meta Query
    • Ordering by Multiple Fields
    • Passing Variables
    • posts_where
    • pre_get_posts
    • Random Ordering
    • Related Posts
    • Sticky Posts
    • Tag Archives
    • Taxonomy Archives
  • Date Query
  • Frequently Asked Questions
  • Filter Hooks
  • Implementation Guide
  • Implementation Methods
  • Loading Styles
  • Masonry
  • Parameters
  • Public JS Functions
  • Repeater Templates
  • Results Text
  • Screenshots
  • Shortcode Builder
  • Stylesheets (CSS)
  • Table of Contents
  • Variables
  • Documentation Home
Code Samples /

Category Archives

The code below will display an archive of posts by category slug.

category.php
<?php 
get_header();
 
if ( is_category() ) {
   $cat = get_query_var( 'cat' );
   $category = get_category ( $cat );
   echo '<h1>' . $category->cat_name . '</h1>';
   echo do_shortcode( '[ajax_load_more category="' . $category->slug . '" cache="true" cache_id="cache-' . $category->slug . '"]' );
}

get_footer(); 
PHP

« Back to Code Samples

  • Ajax Load More
  • Add-ons
    • Cache
    • Call to Actions
    • Comments
    • Custom Repeaters
    • Elementor
    • Filters
    • Layouts
    • Next Page
    • Paging
    • Preloaded
    • Query Loop
    • Search Engine Optimization
    • Single Posts
    • Theme Repeaters
    • WooCommerce
    • Ajax Load More Pro Get instant access to all premium add-ons in a single installation
  • Extensions
    • Advanced Custom Fields
    • Relevanssi
    • REST API
    • SearchWP
    • Terms
    • Users
  • Examples
    • Default
    • Advanced Custom Fields
    • CSS Grid
    • Event Listing
    • Filtering
    • Images Loaded
    • Masonry
    • Multiple Instances
    • Preloaded Posts
    • Progress Bar
    • Search Results
    • WooCommerce
    • View All 30+ Ajax Load More usage examples
  • Docs
    • Add-ons
    • Archives
    • Callback Functions
    • Code Samples
    • FAQs
    • Filter Hooks
    • Implementation Guide
    • Implementation Methods
    • Loading Styles
    • Masonry
    • Parameters
    • Public JS Functions
    • Repeater Templates
    • Results Text
    • Screenshots
    • Shortcode Builder
    • Stylesheets (CSS)
    • Variables
  • Support
  • Download
  • Home
  • Plugins
  • Blog
  • Account
  • Cart
  • Affiliates
  • About
  • Contact

Connekt Media Github Twitter Facebook

A Whitby, Canada based product development company.

©2005 - 2025 Connekt Media | Terms and Conditions

WordPress Plugins

Our plugins are active on 250k+ websites around the globe.

Ajax Load More 50k+ active installations.

Instant Images 200k+ active installations.