• Resolved Viktor Nagornyy

    (@viktorix)


    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/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Viktor,
    Have you downloaded the lastest version that was released last Friday? This version includes custom post types automatically. It then gives you the ability to exclude specific post types if you do not want the PPP meta box to show up.

    Thread Starter Viktor Nagornyy

    (@viktorix)

    Hmm weird. That’s the version I upgraded to and “purchased” shortcode wasn’t working because it lists custom post type “course” and upgrade wiped my change, so I thought I’ll post this suggestion.

    Is that in settings page? I might try re-installing plugin.

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    Ahh, I know what you are talking about now. Let me see what I can do and push out a new version.

    Thread Starter Viktor Nagornyy

    (@viktorix)

    Thanks.

    Plugin Author Matt Pramschufer

    (@mattpramschufer)

    New version pushed!

    = 1.4.3 =
    * Updated the PURCHASED Shortcode to work with all custom post types by default. Uses same Exclude post type functionality from settings screen.
    * Fixed PHP Warning message due to type

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Include custom post types into shortcodes’ is closed to new replies.