Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] Activating sections on custom post type

Home Forums Support Activating sections on custom post type

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #381886
    Jamal

    Hi

    A curious case here. My cpt is called “projekt” and when i use the filter

    add_filter( 'generate_sections_post_types','generate_add_section_post_types' );
    function generate_add_section_post_types() {
          return array( 'page','post','Projekt' ); //<strong>Notice capital P</strong>
    }

    it results in this

    Screenshot

    Screenshot

    A simple solution is to use the correct cpt name in the filter but it took me ages to narrow down what was causing this #lol

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    GeneratePress 1.4
    GP Premium 1.4.3
    #382129
    Tom
    Lead Developer
    Lead Developer

    That’s strange – so that only happens when you use the incorrect name?

    #382244
    Jamal

    Yeah, after testing it some more its even getting stranger. Using something a random name, the filter doesn’t take effect so all is good. When i capitalize one of the cpt name letters that’s when it get crazy. I tried pRojket, projekT, PROJKET and all result in the screenshot above.

    Agressively support the kind of work you want to see. Buy it. Talk about it. Review it.

    #382394
    Tom
    Lead Developer
    Lead Developer

    Interesting – I’ll look into it.

    Thank you!

    #390076
    Kyle Thomas

    Just thought I would add my comments for the next person who comes looking for this information.

    My experience just now has been the opposite. From the advice of this thread, I capitalized the first letter of my CPT and that resulted in the screenshots above with sections NOT working correctly.

    I reverted back to all lowercase in the PHP and it appears to be working correctly.

    #390333
    Tom
    Lead Developer
    Lead Developer

    The value should be the exact slug (case sensitive) of your CPT.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.