to dir
make archive pages
rev 27 oct 2022
Category: web - cpwp - coding

To show all categories, years, ... of posts.

» making it↓  customize title↓   sources↓


.......................................................
✶ making it: 

  Need to make a custom archives page -- 
    a single page that will bring all of your other archives together.
      make a page 'Archive'
      make a template page-archive.php
  This is not the archive.php template -- it is a default in most themes,
     used to display monthly, category, tag, author, and other archive pages. 
  More below in sources.


......................... 
✶ customize the_archive_title()

  You can extend the get_the_archive_title filter 

  https://developer.wordpress.org/reference/functions/get_the_archive_title/
  https://wordpress.stackexchange.com/questions/175884/how-to-customize-the-archive-title/175900
  https://wordpress.stackexchange.com/questions/179585/remove-category-tag-author-from-the-archive-title

  ......................... 
  remove 'Category', 'Tag', etc from title::

add_filter( 'get_the_archive_title', function ($title) {
    if ( is_category() ) {
            $title = single_cat_title( '', false );
        } elseif ( is_tag() ) {
            $title = single_tag_title( '', false );
        } elseif ( is_author() ) {
            $title = '<span class="vcard">' . get_the_author() . '</span>' ;
        }
    return $title;
} );

  
  ......................... 
  Remove 'Archive' from CPT title:

    echo post_type_archive_title( '', false );

    or for something to cover all cases, see elseif code at
      https://wordpress.stackexchange.com/questions/175884/how-to-customize-the-archive-title/175900

  
  ......................... 
  notes:

    probably do in functions file rather than plugin,
    as needs will be different on different websites,
    and can be customised.

.......................................................
✶ sources:

  * how-tos:

    + how to make archive page template:
      https://www.smashingmagazine.com/2015/04/building-custom-wordpress-archive-page/
      https://www.wpthemedetector.com/create-archives-page/
      https://wordpress.stackexchange.com/questions/168452/how-to-make-my-category-archive-behave-like-a-page
      https://www.wpbeginner.com/wp-tutorials/how-to-create-an-archives-page-in-wordpress/
      https://codex.wordpress.org/Creating_an_Archive_Index

    + how to get description also, and display:
	  https://wordpress.stackexchange.com/questions/229742/wp-list-categories-with-category-description/230192#230192

    + More things to do with wp_list_categories:
	   https://www.sitepoint.com/wordpress-categories-api/


  * function ref:
     https://codex.wordpress.org/Function_Reference/wp_get_archives
     https://developer.wordpress.org/reference/functions/wp_get_archives/
     https://wordpress.org/support/topic-tag/wp_get_archives/


  * plugins:



_______________________________________________________
begin 28 jul 2018
-- 0 --