• Resolved Sea Jay

    (@jcollier)


    On the PDF Button screen, not all post types are appearing in “Post types to apply”. Only 5 show up and we have more than that. Is there anything we need to do to get the others to appear?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author dinamiko

    (@dinamiko)

    Hello @jcollier,

    Not sure why those post types are not there but you can try to use dkpdf_posts_arr filter that allows you add more post types to show the PDF Button.

    In the following example it adds a custom post type with slug nav_menu_item:

    <?php
    /**
    * Adds post type nav_menu_item in PDF Button Post types to apply
    */
    function add_dkpdf_posts_arr( $post_arr ) {
    array_push( $post_arr, 'nav_menu_item' );
    }
    add_filter( 'dkpdf_posts_arr', 'add_dkpdf_posts_arr' );
    ?>
    Thread Starter Sea Jay

    (@jcollier)

    I added that code to functions.php, changing nav_menu_item to my custom post type and it removed all post types from the PDF button screen. Should that code go somewhere else?

    Plugin Author dinamiko

    (@dinamiko)

    @jcollier sorry my bad, the example I provided is missing the return after adding the post type. Try adding this line after the array push:

    return $post_arr;

    Try it and let me know.

    Thread Starter Sea Jay

    (@jcollier)

    When I added the updated code, our resources custom post type now appears as a choice on the PDF Button tab. Thank you.

    However, the button is not appearing after the content on those resource posts, as it is appearing on all pages.

    Plugin Author dinamiko

    (@dinamiko)

    @jcollier do you know how that custom post type is registered? or is there a way I can check that via a plugin or register post type code snippet?

    Here is what the plugin uses to get the post types, currently only public post types, maybe yours is private?

        $args = array(
    'public' => true,
    '_builtin' => false
    );

    $post_types = get_post_types( $args );
    Thread Starter Sea Jay

    (@jcollier)

    Hi @dinamiko

    The post type is registered by Pods as Public, Public Queryable, Content Visibility is Public, and User Capability is the same as Page..

    Yes, please do send a code snippet that I can add to functions.php and I’ll report the results.

    TIA!

    • This reply was modified 1 year ago by Sea Jay.
    Thread Starter Sea Jay

    (@jcollier)

    Hi! Any update on this? The custom post type is set to public in all facets.

    Plugin Author dinamiko

    (@dinamiko)

    @jcollier sorry for the delay, I’ve found why Pods post types are not displayed in “PDF Button / Post types to apply” option, in the settings code the init action has a priority of 11 which is lower that the one used by Pods, to fix it you can change the value from 11 to 20, by doing so Pods custom post types should appear correctly.

    I’ll include this fix in the next release, in the meantime you can change the value manually in the following file in line 20: includes/class-dkpdf-settings.php

    Thread Starter Sea Jay

    (@jcollier)

    That works. Thank you so much!!!

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Custom Post Types’ is closed to new replies.