Support » Themes and Templates » Custom Post Type archive in Menu

  • I have been having this issue for a while and have done some odd workarounds but I am wondering if anyone has any insight? So I have a custom post type. Call it Movies. So the URL to the archive page for all Movies would be

    I would like to make this a menu item using the menu interface. The only current way I can do this is to make custom link. This works ok, however I would really like the menu item class to be set as an ancestor or parent when you are within one of the custom post type single pages or taxonomy pages.

    It is possible to make a page with the slug that matches the custom post type but the class doesn’t register and also it does not recognize custom post type single items and taxonomies as children.

    Anybody have any ideas on this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was having a similar issue with this, I fond a solution that isn’t exactly the most elegant work-around, but it does the job.

    Firstly, make sure your body tag reads:
    <body <?php body_class(); ?>>

    This’ll add a class to your body that will be unique to your custom post type. Next thing to do is go to your custom menu, make sure CSS Classes is turned on under Screen options, then give your custom link a class. You can then target it in CSS so it gets highlighted when under a particular body tag.

    I realise this probably isn’t too useful for you 4 months on, but I thought I’d share it cos I went on a hunt for this info myself and A post explaining how to do it would’ve been useful!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Post Type archive in Menu’ is closed to new replies.