• Resolved beingtree

    (@beingtree)


    This is just to help anyone else who needs the same functionality I did.

    Currently, the PUM shortcode button only shows “Popup Cookie” when you’re on a custom post type. There is a filter you can hook into to make PUM shortcode fully functional on custom post types: pum_shortcode_post_types.

    Here is a generic version of my implemmentation (put it in your theme’s functions file):

    /* Add full Popup Maker shortcode functionality to ustom post types */
    	function theme_name_product_pum_shortcode($pum_post_types) {
    		$pum_post_types[] = 'product'; // this is the WooCommerce Product post type
    		/*
    		  If you want to add to multiple, just add more lines like the above, using the appropriate post type names.
    
    		If you need to add to a lot of post types, you could make an array, and use array_merge.
    		*/
    		return $pum_post_types;
    	}
    	
    	add_filter('pum_shortcode_post_types', theme_name_product_pum_shortcode');
    • This topic was modified 3 years, 7 months ago by beingtree.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Bel

    (@belimperial)

    Hi @beingtree

    Thank you for sharing this information.

    I was checking the code for WooCommerce product editor and it appears it is missing a single quote in the add_filter – ‘theme_name_product_pum_shortcode’.

    Here’s the updated code:

    /* Add full Popup Maker shortcode functionality to ustom post types */
    	function theme_name_product_pum_shortcode($pum_post_types) {
    		$pum_post_types[] = 'product'; // this is the WooCommerce Product post type
    		/*
    		  If you want to add to multiple, just add more lines like the above, using the appropriate post type names.
    		If you need to add to a lot of post types, you could make an array, and use array_merge.
    		*/
    		return $pum_post_types;
    	}
    	
    	add_filter('pum_shortcode_post_types', 'theme_name_product_pum_shortcode');

    Everything is perfect with the code. Thank you for sharing this.

    Thread Starter beingtree

    (@beingtree)

    @belimperial, Woops! Thanks for catching that. I think when I “generic-ified” it, I must’ve deleted the quote ??

    Maria T

    (@mariatogonon)

    Hi there @beingtree, on behalf of Bel?you are welcome! ??

    By the way, if you have a moment then we would very much appreciate it if you could quickly?rate the plugin, just to help us spread the word.

    Have a great day & keep safe!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PUM Shortcode Full Functionality with Custom Post Types’ is closed to new replies.