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' );
?>
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?
@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.
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.
@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 );
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.
Hi! Any update on this? The custom post type is set to public in all facets.
@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
That works. Thank you so much!!!