[Resolved] Apply Sections to Custom Post Types?

Home Forums Support [Resolved] Apply Sections to Custom Post Types?

Home Forums Support Apply Sections to Custom Post Types?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #145599
    Daniel Walker

    Hi Tom, is it possible to apply Sections to custom post types?

    Thanks,
    Dan

    #145668
    Tom
    Lead Developer
    Lead Developer

    Hi Dan,

    You should be able to do something like this:

    add_filter( 'generate_sections_post_types','generate_add_section_post_types' );
    function generate_add_section_post_types()
    {
          return array( 'page','post','yourposttype' );
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    #146021
    Daniel Walker

    Perfect. And thanks for the speedy response.

    Dan

    #146069
    Tom
    Lead Developer
    Lead Developer

    Happy to help πŸ™‚

    #157074
    Daniel Walker

    Hi Tom, I didn’t notice a side effect of adding Sections to custom post types until today: it stops custom post archive pages from displaying all pages of that custom post type. Only the newest page using Sections is displayed when you navigate to siteURL/category/customposttype/

    If all my pages for a custom post type don’t use Sections then the archive (archive-customposttypename.php) displays correctly and shows the headings and excerpts for all of those posts.

    Is there something I can add to my archive-customposttype.php template to get it to ignore the Section content and display as an ‘archive’?

    Kind regards,
    Dan

    #157138
    Tom
    Lead Developer
    Lead Developer

    Hi Dan,

    This is an issue with using Sections with posts/post types that display archives.

    I’ll have to come up with a way to remove items using Sections from those lists completely, as I don’t see a way of them fitting into a blog post layout.

    I’ll look into this and get back to you πŸ™‚

    #181691
    Tom
    Lead Developer
    Lead Developer

    Hi Daniel,

    This should be fixed in the latest version πŸ™‚

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