Include custom post types into shortcodes
-
Hey, right now plugin only checks pages and posts, and if a custom post type is protected, the shortcodes will not show it. For example, we have “courses” custom post type and protect them. But “purchased” shortcode is empty. Would be great if you could automatically include custom post types too. Would be great if we had a simple list of custom post types with checkboxes on the settings page, so we can select which to include.
For anyone who wants a quick fix:
Inside woocommerce-payperpost.php file, lines 165 – 176:
//Grab a list of posts which have the WCPPP meta key filled in $args = array( 'orderby' => 'post_date', 'order' => 'DESC', 'nopaging' => true, 'meta_key' => self::METAKEY, 'meta_value' => '0', 'meta_compare' => '>', 'post_status' => 'publish', 'post_type' => array( 'post', 'page', 'course' ) );
Simply add your custom post type inside “post_type” array. You can see above I’ve added “course” custom post type.
WARNING: This will be deleted if you upgrade plugin. So make sure to re-do it after each upgrade, until this feature is part of the plugin.
https://www.ads-software.com/plugins/woocommerce-pay-per-post/
- The topic ‘Include custom post types into shortcodes’ is closed to new replies.