Knowledgebase function How to list subcategory items on home page using template

This support request was posted in Flatbase by tondeuse

Request ID #7202 In Progress
  • Hello,

    I am working on customizing the home page template for my flataland child theme and trying to reveal the hiearchy of three (3) nested categories with child subcategories. I have created an override function in my child theme and I am invoking it from template-home.php as such :


    nicethemes_knowledgebase_vdm( array(
    'columns' => 3,
    'numberposts' => 30,
    'orderby' => 'title',
    'before' => '',
    'after' => ''
    )
    );

    Somehow, I cannot figure out how to get my category tree to show as such on my home page, any clues or hints? Is this functionnaluty, which is clearly part of the nicethemes_knowledgebase() function executed only when using a shortcode tag, which is not my usage scenario?

    Here is what I woul expect to obtain, the result I am looking after, repeated 3 columns wide :


    * Root category one (C)
    - Article a (Ca)
    - Article b (Cb)
    ** Sub category one (C1)
    -- Article a (C1a)
    -- Article b (C1a)
    -- Article c (C1a)
    ** Sub category three (C3)
    -- Article a (C3a)

    So, some articles may inherit only from the root category, some other articles may inherit from a child category of the root category, and should therefore, in our usage logic, be nested under the child category. The subcat title should remain hyperlinked.

    If this may not be achieved using arguments for the function, what kind of alterations would you suggest in order to get the subcategory display to occur in my child theme override function (nicethemes_knowledgebase_vdm)?

    Thanks for your tip, I much appreciate your time, please direct me to another ticket if I have not seen an answer to my question in another post on the subject in the forums, I created an account for support as I could not find one that clearly documented this specific need.

    Juanfra Aldasoro

    Hi,

    Thank you for writing. I hope you are doing well.

    Unfortunately we cannot provide support on customizations, and unfortunately as we cannot see the code of the function you have redefined it’s really hard to know what could be the reason why it is not working as expected.

    What are you currently trying to achieve on the home page? Perhaps we can find a solution with the original function (which is plenty of hooks to be modified).

    Thank you,
    Juan.

    To make my question simple, I am trying to show articles listed under each subcategory, as in my example above (C1a, C1b, etc.). I do not know for sure if I need to override the existing nicethemes_knowledgebase() function in my child theme. I sort of whish I did not have to, as the code to display subcategories is existant in the function

    I am assuming it will not be necessary, and that calling the native function in the parent theme, with the right arguments, should do the job. I just need hints to call the function with the right arguments so as to trigger the subcategory display.

    I have 3 nested categories, they are listed side by side on my home page.

    Thank you so much.

    Martin

    Juanfra Aldasoro

    Hello Martin,

    I hope you are doing well.

    Would you please send me your site access details to support@nicethemes.com with a reference to this topic so I can take a look at your knowledgebase configuration?

    Best,
    Juan

    Hello Juan,

    I am sorry to be a bit of a sticky client, I have come to results after digging a bit deeper and I have exposed my finding and will share them with you before leaving for the weekend.

    It seems like the $subcat_args variable was not properly initialized, in the nicethemes_knowledgebase() function, before calling the get_categories( $subcat_args ) function.

    In order to enter the subcategory routines, it needed to have the extra key-value pair ‘taxonomy’ => ‘article-category’, for my use case, anyways. This is the finding that finally got me coding and moving.

    I have not tested my code beyond my very specific use case and business logic, I hope my suggestions helps resolve similar issues for some other clients of yours.

    You may mark the other issue I have created as resolved as well.

    Documentation for nicethemes_knowledgebase() function arguments

    Best regards, have a great weekend.

    Martin

    Juanfra Aldasoro

    Hi Martin,

    Thank you very much for the follow up.

    And thank you so much for the heads up, I’ve just seen what you mention, the sub category query is not made for the ‘article-category’ custom taxonomy. We’ll be fixing this bug for the upcoming release.

    Thanks again and have a great weekend you too.

    Best,
    Juan.

Viewing 6 posts - 1 through 6 (of 6 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