KB Content on Home Page vs on a Dedicated KB Page

This support request was posted in Flatbase by mwdonnelly

Request ID #5637 In Progress
  • Is there a way to designate or limit which KB categories are displayed on the Home page? Or what number of categories are shown on the Home page? It makes sense that the Knowledge Base page would show ALL categories in the KB. As it stands, it seems like ALL categories are shown both on the Home page and the KB page. Is that right, or am I missing a setting here?

    Andrés Villarreal

    That can’t be done through a setting, though you can use a filter hook as the following and play around with the include and exclude keys:

    add_filter( 'nicethemes_knowledgebase_default_args', 'nice_knowledgebase_custom_args' );
    function nice_knowledgebase_custom_args( $args ) {
    	if ( is_frontpage() ) { // Check we're in the front page.
    		$args['exclude'] = 1,2; // Exclude categories with ID 1 and 2.
    		$args['include'] = 3,4; // Include only categories with IDs 3 and 4.
    	}
    
    	return $args;
    }
    

    Those arguments will be passed to the get_category() function, so you may want to take a look at the documentation about that function in the Codex to see what other arguments you can use: https://codex.wordpress.org/Function_Reference/get_categories.

    Hope this helps.

    Best,

    Andrés.

    Thanks Andres. I take it that this needs replace the code in the Home page template in order to select which content I want displayed.

    I’m wondering why there is a Knowledge Base page template if the displayed content does not differ from that on the Home Page. It seems redundant unless there are selectors to customize the content on the Home Page and then have all KB articles on the KB page.

    Andrés Villarreal

    You’re in the right direction, that’s what the hook does.

    We’re taking your observation into account for a next version of the theme. Thanks for your feedback.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

Login to your Account

Welcome back! Please log in to your account by filling the fields below:

Forgot?

Not a member? Create a free account.

Create a Free Account

You're 27 seconds away from some awesome WordPress free stuff, benefits and more. Create a free account and have access to our free products, benefits and more!

Already have an account? Log in
Secure Server