Support » Plugin: Category Posts in Custom Menu » Is it possible to get Sub Category post nested?

  • Resolved Shabith

    (@shabith)


    Hi,

    I have a small question. My category and post structure is like below.

    Category
    - Post 1
    - Post 2
    - Post 3
    - Cat A
    - - Post A 1
    - - Post A 2
    - Cat B
    - - Post B 1
    - Cat C
    - - Post C 1

    And I want to show it in main navigation like a mega menu. But using your plugin I was only be able to get all the post as a list (not a sub category nested list).

    Is it possible to get nested post list like above?

    Thanks

    https://wordpress.org/plugins/category-posts-in-custom-menu/

Viewing 15 replies - 1 through 15 (of 18 total)
  • Plugin Author Diana Koenraadt

    (@anaid)

    Hi Shabith,

    you can do this manually under Appearance > Menus.

    Add ‘Category’ to your menu, check “Create submenu containing links to posts in this category.” and choose under “Remove original menu item” the option ‘Never’.

    Then, under Category, you can add Cat A, Cat B, Cat C etc. Be sure to drag them all a little to the right, so that they really fall under Category.

    Category
        Cat A
        Cat B
        Cat C

    For Cat A, B and C also check the checkbox and choose ‘Never’ from the dropdown.

    Kind regards,
    Diana

    Hi Diana,

    Thanks for your reply.
    I did like you asked and now It shows posts in sub categories twice.
    Like below.

    `Category
    – Post 1
    – Post 2
    – Post 3
    – Post A 1
    – Post A 2
    – Post B 1
    – Post C 1
    – Cat A
    – – Post A 1
    – – Post A 2
    – Cat B
    – – Post B 1
    – Cat C
    – – Post C 1′

    Is there any option to tell the plugin to not to list post belongs to sub category inside the parent category?

    Plugin Author Diana Koenraadt

    (@anaid)

    Hi Shabith,

    ah, good point. I did not realize this when I suggested the solution. Right now there is no way to exclude posts from the category if they are also in a sub-category. When I have the time, I will look into this.

    Kind regards,
    Diana

    Hi Diana,

    Thanks for this great plugin. πŸ™‚
    Btw I manage to add that option by altering your plugin.
    Now it’s work for first sub level but not below that. But it’s fine for my theme.

    Cheers,
    Shabith

    Hey Shabith,

    i need exactly the same, would you be so kind to share your alterations? πŸ˜‰

    Cheers,
    Benni

    Hi,
    I’m not sure which php file I made the change.

    category-posts-in-custom-menu.php http://pastebin.com/dLL8e3Ds
    cpcm-functions.php http://pastebin.com/fvAwBue6

    Cheers!

    Hi Shabith,
    thanks for the quick response, but well.. i couldn’t spot any difference to the original plugin files in those two files ΓΆ.Γ–

    Hi,

    sorry about the late reply.
    Have a look at this code.

    category-posts-in-custom-menu.php – http://pastebin.com/faHC884x

    I think it would be nice that the plugin had a “recursive” mode so you can add “Category” to your custom menu and get this:

    Category
    – Cat 1
    – Post 1
    – Post 2
    – Cat 2
    – Cat 3
    – Post 3

    Plugin Author Diana Koenraadt

    (@anaid)

    Hi all,

    implementing a “recursive” mode isn’t as simple as it sounds, but I’ve done some preliminary work. Would you be willing to test the current development version of the plugin?

    I’ve added support for a skip parameter, as well as an option on what to do with subcategory posts. You can now choose to ‘exclude’ them. You will have to add the desired categories manually for now, but this allows you to avoid the situation in Shabith’s second post of this thread.

    I.e. for category structure
    Cat 1
      Post 1
      Cat 2
        Post 2

    you can create in your menu

    Cat 1 – set ‘exclude’ subcategory posts
      Cat 2

    Kind regards,
    Diana

    Hi Diana,

    I “strongly” need the plugin to work on nested categories and I am available to test any beta version you may need.

    Plugin Author Diana Koenraadt

    (@anaid)

    Hi fmazocca,

    the Development Version adds *some* support for nested categories. What it *does not* do, is automatically *find* the categories.

    So, what you need to do is:
    – Add the category and its subcategories to the menu
    – For each category and subcategory, you check “Create submenu containing links to posts in this category.”
    – Ensure that for all categories and subcategories, “Remove original menu item” is set to “Never”.

    I.e. in the backend, under Appearance > Menus, you create the structure

    Category A
    – Category B

    Now, what you will see in the menu on your site (frontend) is something like this:

    Category A
    – Post A1
    – Post A2
    – Post B1
    – Category B
    — Post B1

    For this, I’ve added a new option, called “Subcategory posts”. What you need to do, is set this to “Exclude” for Category A. This makes Category A skip the posts that belong to a subcategory. Now you get:

    Category A
    – Post A1
    – Post A2
    – Category B
    — Post B1

    You can download the latest Development Version from https://wordpress.org/plugins/category-posts-in-custom-menu/developers/. Click “Development Version” to download a .zip file.

    Let me be clear, I would like to add functionality to have the plugin automatically find the categories itself, but for now it’s just not feasible. I want to get version 1.0 of the plugin out first, as soon as I have found at least two people who have tested it thoroughly. After that, we’ll see what 2015 brings.

    If you’re willing and able to test the new version, yes please! πŸ™‚

    Kind regards,
    Diana

    Diana,

    thank you very much!

    I will download the devel version and test it. Will report here?

    Regards

    Fabio

    After few initial tests it works perfectly!!

    Thank you.

    Diana,

    I am experiencing some responsive problem only on 3rd level submenus on phones and tablets. It doesn’t open, while it works on a standard PC.
    On mobile devices, when I access a 3rd level submenu, it opens for a moment just to show its posts, and then suddenly the menu collapses back so I can’t click on the post link.

    Fabio

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Is it possible to get Sub Category post nested?’ is closed to new replies.