• There is an issue with the otherwise excellent WPSP 1.1.3 as, while it is easy to generate a list of category posts for a specific category, it is not possible to generate a list for any category without generating a specific page and list entry for each one.

    Where there are many categories all requiring the same format, this is pointless, time consuming and error prone. In defence, it appears that none of the the display posts plugins will do this either!

    I am using generatepress premium with generateblocks pro, into which WPSP is due to be merged. So I hope that this restriction will be removed in GB.

    I have modified the code on my installation (switching off auto-updates!) to extract the category from the URL and overwrite the $settings[ ‘tax_term’ ] entry by adding the following lines to wp-show-posts.php immediately after the check on $custom_settings:

    $thisCat = single_cat_title("",false); // requested category from URL as title of page
    $settings[ 'tax_term' ] = get_queried_object($thisCat)->slug; // to limit the display to the specified single category
    if ( '' !== $settings[ 'tax_term' ] ) {
    	echo '<center><h4 style="margin-bottom:10px;padding=0"><a href="/category/'. $settings[ 'tax_term' ] .'" posts>'.$thisCat.' posts</a></h4></center>';	
    }
    

    This will then display for all categories and ignore the settings in WPSP setup. It would be very easy to change to displaying where only the categories checked are included by moving the check further down but I want all categories to be possibly visible, as in standard WordPress. This only works for categories at the moment but tags are little used and archives too – that is work in progress!

    This then needs a simple archive page created, into which the shortcode is placed. My page is just:

    <?php
    /* 
    Template Name: Archives
    */
    get_header(); ?>
    	<div id="primary" class="site-content">
    		<div id="content" role="main">
    		<h1 class="entry-title"><?php the_title(); ?></h1>
    			<div class="entry-content">
    			</div><!-- .entry-content -->
    		</div><!-- #content -->
    </div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

    I could of course have put the php into this instead of the shortcode in the page!

    This raises a small problem, at least with generatepress where page comments are switched off (they are). There is an unwanted (and incorrect) display in id=nav-below which can (until corrected by GP) is simply removed by:

    #nav-below {display:none}
    

    which leaves any next page links correctly handled by WPSP.

    I don’t know whether this is corrected in WPSP Pro but I can’t access this now as it is being merged. Present WPSP Pro users are getting a discount on GB Pro. Perhaps GB Pro users could be rewarded with a free WPSP Pro…. ? 🙂

    • This topic was modified 4 years, 3 months ago by Loggy.

The topic ‘Displaying category archives’ is closed to new replies.