Skip to:
Content
Pages
Categories
Search
Top
Bottom

Additional Taxonomies for Posts and Replies


  • Back to Front
    Participant

    @traverser11

    Hi there,

    I’m looking for a general advice if I’m hading in the right direction how to allow users to categorise their topics and replies? I’m making progess but having trouble to display those topics in the term archives, display the terms in the forum posts, etc.

    In building in custom taxonomies should I be building on top of the existing topic tags, making them hierarchical –

    Or taking the approach of registering two new taxonomies –

    • ‘region’ eg ‘Australia, New Zealand, Tasmania’
    • ‘issue’ eg ‘homelessness, rough sleeping, couchsurfing

    I’ve then added a term picker to the new topic form –

    But I’m stuck getting topics/replies to display on the the term archives,
    this doesn’t seem to work to eg to display topic on this archive
    https://www.forum.backtofrontdesign.co/region/victoria/
    am i using the correct post type slugs?

    function add_post_types_to_archives( $query ) {
    	// We do not want unintended consequences.
    	if ( is_admin() || ! $query->is_main_query() ) {
    		return;    
    	}
    
            if ( is_category() && empty( $query->query_vars['suppress_filters'] ) ) {
    
    		// Add more slugs with the other CPTs.
    		$post_types = array( 'topic');
    
    		$query->set(
    	  		'post_type',
    			array_merge(
    				array( 'post' ),
    				$post_types
    			)
    		);
    	}
    }

    I’ll keep persevering to display the terms on forum archives and single topics, but any advice or assistance from the community would be so much appreciated to get this campaign up and running.

    Forums


    A project for https://www.oldertenants.org.au/

Viewing 2 replies - 1 through 2 (of 2 total)

  • Back to Front
    Participant

    @traverser11

    Oh I found the error in my code above
    Just replacing
    is_category()
    with
    is_archive()

    Still, not sure I’m taking the best approach here,
    maybe I’m missing a simpler way to categorise topics?


    neon67
    Participant

    @neon67

    Like a different approach.
    Do you have a confusing system of tags and categories? Look towards plugins make a hierarchy categories and tags, such as “Table of Contents Plus”.
    …automatically creates a context specific index or table of contents (TOC) for long pages (and custom post types) … a sitemap listing pages and / or categories … a unique numbering scheme .. alphabetical sorting of tags and so on

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar