• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom Archive Page for Category

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom Archive Page for Category

This topic is: not resolved

Tagged: archive page, category

  • This topic has 4 replies, 4 voices, and was last updated 10 years, 11 months ago by mitchb13.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 12, 2014 at 4:34 am #89937
    tribalcafe
    Member

    I have the following code which nicely sorts posts into date order just using titles. However I want to try to create separate archives for each category. Anybody got any ideas on how to do this amending code or pointing me in right direction.

    <?php

    //* Template Name: Custom Archive

    //* Remove standard post content output
    remove_action( 'genesis_post_content', 'genesis_do_post_content' );
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );

    add_action( 'genesis_entry_content', 'sk_page_archive_content' );
    add_action( 'genesis_post_content', 'sk_page_archive_content' );
    /**
    * This function outputs posts grouped by year and then by months in descending order.
    *
    */

    function sk_page_archive_content() {

    global $post;

    $lastposts = get_posts('numberposts=-1') ;
    $year = '';
    $month = '';
    foreach($lastposts as $post) :
    setup_postdata($post);

    if(ucfirst(get_the_time('F')) != $month && $month != ''){
    echo '';
    }
    if(get_the_time('Y') != $year && $year != ''){
    echo '';
    }
    if(get_the_time('Y') != $year){
    $year = get_the_time('Y');
    echo '

  • <h2>' . $year . '</h2><ul class="monthly-archives">';
    }
    if(ucfirst(get_the_time('F')) != $month){
    $month = ucfirst(get_the_time('F'));
    echo '
  • <h3>' . $month . '</h3>
      ';
      }

      ?>

    • <span class="the_date"><?php the_time('d') ?>:</span>
      "><?php the_title(); ?>
    • <?php endforeach; ?>

    <?php

    }

    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
    remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
    remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );

    genesis();

April 13, 2014 at 10:48 am #100053
Susan
Moderator

As you posted this a while back, I hope you were able to get your issue resolved. If not, please check back in here, and I will escalate for you.

If it is resolved, please mark the thread “resolved”, and I will close it.

Thanks!

August 28, 2015 at 8:30 pm #163958
mitchb13
Member

I saw this post and my heart jumped. Too bad this is not solved. I have been looking everywhere to learn how to simply add a page number to the title on category and tag pages. It seems to be impossible.

Anybody out there know how this is done?

August 29, 2015 at 2:03 am #163974
Brad Dalton
Participant

You could try

the_id()

https://codex.wordpress.org/Function_Reference/the_ID


Tutorials for StudioPress Themes.

September 8, 2015 at 7:31 pm #164982
mitchb13
Member

I found the answer. I wish I could figure out where I got the code snippet from to credit it. I hacked a bit of it up to make it work the way I wanted.

The following will add "Page 2", "Page 3", and so on to index, tag, and category pages when added to functions.php.

function theme_name_wp_title( $title, $sep ) {
	global $page, $paged;
	if ( is_feed() || is_home() ) {
	// Add a page number if necessary:
	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
		$title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) );
	}
	return $title;
	}
	
	

	// Add the blog description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) ) {
		$title .= " $sep $site_description";
	}

	// Add a page number if necessary:
	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
		$title .= " $sep " . sprintf( __( 'Page %s', '_s' ), max( $paged, $page ) );
	}

	return $title;
}
add_filter( 'wp_title', 'theme_name_wp_title', 10, 2 );
  • Author
    Posts
  • Viewing 5 posts - 1 through 5 (of 5 total)
    • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

    CTA

    Ready to get started? Create a site or shop for themes.

    Create a site with WP EngineShop for Themes

    Footer

    StudioPress

    © 2026 WPEngine, Inc.

    Products
    • Create a Site with WP Engine
    • Shop for Themes
    • Theme Features
    • Get Started
    • Showcase
    Company
    • Brand Assets
    • Terms of Service
    • Accptable Usse Policy
    • Privacy Policy
    • Refund Policy
    • Contact Us
    Community
    • Find Developers
    • Forums
    • Facebook Group
    • #GenesisWP
    • Showcase
    Resources
    • StudioPress Blog
    • Help & Documentation
    • FAQs
    • Code Snippets
    • Affiliates
    Connect
    • StudioPress Live
    • StudioPress FM
    • Facebook
    • Twitter
    • Dribbble