KB Content on Home Page vs on a Dedicated KB Page
This support request was posted in Flatbase by mwdonnelly
- mwdonnelly April 27, 2015 at 3:22 pm
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 April 27, 2015 at 9:06 pmThat 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.
mwdonnelly April 28, 2015 at 12:12 amThanks 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 April 28, 2015 at 3:20 pmYou’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.
You must be logged in to reply to this topic.