WordPress.org

Forums

Category Posts in Custom Menu
[resolved] Is it possible to get Sub Category post nested? (19 posts)

  1. Shabith
    Member
    Posted 12 months ago #

    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/

  2. Diana Koenraadt
    Member
    Plugin Author

    Posted 12 months ago #

    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

  3. Shabith
    Member
    Posted 11 months ago #

    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?

  4. Diana Koenraadt
    Member
    Plugin Author

    Posted 11 months ago #

    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

  5. Shabith
    Member
    Posted 11 months ago #

    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

  6. bboehm86
    Member
    Posted 9 months ago #

    Hey Shabith,

    i need exactly the same, would you be so kind to share your alterations? ;-)

    Cheers,
    Benni

  7. Shabith
    Member
    Posted 9 months ago #

    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!

  8. bboehm86
    Member
    Posted 9 months ago #

    Hi Shabith,
    thanks for the quick response, but well.. i couldn't spot any difference to the original plugin files in those two files ö.Ö

  9. Shabith
    Member
    Posted 9 months ago #

    Hi,

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

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

  10. jofefe
    Member
    Posted 9 months ago #

    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

  11. Diana Koenraadt
    Member
    Plugin Author

    Posted 9 months ago #

    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

  12. Fabio Marzocca
    Member
    Posted 4 months ago #

    Hi Diana,

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

  13. Diana Koenraadt
    Member
    Plugin Author

    Posted 4 months ago #

    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

  14. Fabio Marzocca
    Member
    Posted 4 months ago #

    Diana,

    thank you very much!

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

    Regards

    Fabio

  15. Fabio Marzocca
    Member
    Posted 4 months ago #

    After few initial tests it works perfectly!!

    Thank you.

  16. Fabio Marzocca
    Member
    Posted 4 months ago #

    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

  17. Fabio Marzocca
    Member
    Posted 4 months ago #

    Diana,

    I have just found that the behavior I described in my last post is not due to your plugin, but to another one, which I am troubleshooting now.

    Thanks

    Fabio

  18. Diana Koenraadt
    Member
    Plugin Author

    Posted 4 months ago #

    Hi Fabio,

    that's good to hear, that it works well :)

    Just a few checks:

    - Have you tested under WordPress 4.0?
    - Have you tested a good mix of options?

    Thank you very much for testing. I'll be waiting for a second user to have tested it, then I'll release it. If you do encounter any problems that are caused by my plugin, please let me know.

    Kind regards,
    Diana

  19. Fabio Marzocca
    Member
    Posted 4 months ago #

    Diana,

    I'm testing it with WP 4.0.1 and it works perfectly... I cannot include a link here as the site is still experimental and I cannot share it, but I can send some screenshot if I had your email address.

    You can find me on LinkedIn.

    Fabio Marzocca

Reply

You must log in to post.

About this Plugin

  • Category Posts in Custom Menu
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic