• Resolved Hadhops

    (@hadhops)


    Hello,

    The latest update looks great, however I cannot seem to add the uploader meta box to a custom post type.

    With the older version this works –

    add_action( 'add_meta_boxes', 'listing_custom_box' );
    
    function listing_custom_box() {
    	add_meta_box('ps_custom_post_type_uploads', __('Portfolio Slideshow', 'port_slide'), 'ps_custom_post_type_uploads', 'listing', 'normal', 'default');
    }

    But not anymore. Can you please provide me with updated code / knowledge on how to achieve this?

    Thank you.

    PS. My site is being developed locally for now so I cannot provide a link.

    https://wordpress.org/plugins/portfolio-slideshow/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Hadhops

    (@hadhops)

    Oh sorry I forgot to post the error message –

    Warning: call_user_func() expects parameter 1 to be a valid callback, function ‘ps_custom_post_type_uploads’ not found or invalid function name in /Applications/MAMP/htdocs/applewood/wp-admin/includes/template.php on line 1074

    Hope to hear back soon:)

    Plugin Author ggwicz

    (@ggwicz)

    Hey @Haphops!

    I’m sorry you’ve run into trouble here. There are two things to point out here:

    1. My poor job with documentation

    Portfolio Slideshow’s documentation is not very good right now. I’m working hard to fix this, but if there was better documentation you probably would’ve found out about the new to register the uploader many places. So, sorry about that. But there is indeed a new way to do this, and it’s quite easy actully!

    2. The actual new way to do this

    Portfolio Slideshow is being built to easily extend to whatever post type you use. There are only two default post types where the uploader box will appear: ‘post’ and ‘page’. To add your ‘listing’ post type, just use the new portfolio_slideshow_get_supported_types() filter, e.g. by placing code like the following in your theme’s ‘functions.php’ file:

    <?php
    
    /**
     * Add Portfolio Slideshow support for the "listing" post type.
     *
     * @link http://goo.gl/22u79b
     */
    add_filter( 'portfolio_slideshow_get_supported_types', function( $post_types ) {
        $post_types[] = 'listing';
        return $post_types;
    });

    That should do it, for one or multiple post types.

    Let me know if that helps!

    Thread Starter Hadhops

    (@hadhops)

    That nailed it!

    Thanks for the great plugin and support 🙂

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

The topic ‘V1.10 Adding meta box to custom post type’ is closed to new replies.