WordPress.org

Ready to get started?Download WordPress

Forums

WP Customer Reviews
[resolved] Register Widgets in Custom Admin Menu & [Plugin: WP Customer Reviews] (6 posts)

  1. Jerry Craig
    Member
    Posted 3 years ago #

    Sorry, it's a 2 fold question. For the plugin mentioned as well as in general. How do I register my custom plugin in a specific Admin Menu that has been created to handle my Custom Post Types?

    I love the plugin so far and hope I can get it to work. The problem is that I'm using Custom post_types. I think someone else was mentioning this as well. The Widget shows up on the Posts Pages, and when entering Pages, but not for my Custom post_type. It's not registered in the Java at the top of the page in the Screen Options for me to be able to turn it on. How do I register your widget on my custom post_type page? I know that the scren options is java, and I'm sorely lacking in any knowledge about that. Do I just need to call or register the widget in that sub_menu?

    Thanks,

    http://wordpress.org/extend/plugins/wp-customer-reviews/

  2. Jerry Craig
    Member
    Posted 3 years ago #

    well, here's a starter for everyone:

    http://codex.wordpress.org/Function_Reference/add_meta_box

    I need to add_meta_box to my custom post_type menu. I'm just going to need to know the $callback and the $callback_args I think. If anyone has any ideas it would be helpful

  3. Jerry Craig
    Member
    Posted 3 years ago #

    It's going to need an add around lines 104-106 of wp-customer-reviews-admin.php where it adds the meta box. It's adding ot the 'page' on 105 and the 'post' on line 106.

    /* add for pages and posts */
    		add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), 'page', $meta_box['context'], $meta_box['priority']);
    		add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), 'post', $meta_box['context'], $meta_box['priority']);

    I'm not sure what is "best practice" for adding something into someone else's plugin so that I don't make it harder on myself later down the road. Any ideas? It works if I just duplicate the 'post' line and insert my custom post_type. But, i'm not sure if I'll remember that down the road.

    A change maybe to line 49 where it assigns 'page' => 'page' and make it this=>post_type or something like that. I'm a rather big noob, so i'm grabbin at straws here.

    Thanks,

  4. Nick Davis
    Member
    Posted 3 years ago #

    Hi Jerry, thanks for your message, appreciate the nudge

    I'll give this a go!

    Thanks

    Nick

  5. mjpg
    Member
    Posted 3 years ago #

    I am also new to this, but a more flexible option I tried was to get all custom post types automatically like this:

    wp-customer-reviews-admin.php
    After line 107

    /* add for custom post types */
    		$post_types=get_post_types('','names');
    		foreach ($post_types as $post_type ) {
    			add_meta_box($meta_box['id'], $meta_box['title'], array(&$this, 'wpcr_show_meta_box'), $post_type, $meta_box['context'], $meta_box['priority']);
    		}
    /* END add for custom pst types */

    Obviously this is not great if the Plugin code changes.

  6. bompus
    Member
    Plugin Author

    Posted 3 years ago #

    2 shortcodes have been added, that -SHOULD- work for custom post types.

    1 for displaying reviews only (for use in a sidebar, homepage, etc) and 1 for displaying the current page's reviews and the review form. The codes should be able to be placed anywhere you want on any page.

    Any issues, please let me know. No styling has been done for showing reviews on any page, so for now you may need to roll your own CSS for that into your theme. An update to that may come later once everyone approves that it is working correctly for them.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic