Add custom meta box on Post page

You need to use the add_meta_box function add_action( ‘add_meta_boxes’, ‘my_custom_meta_box’ ) ); function my_custom_meta_box(){ $args = array(); add_meta_box( ‘my_metabox_id’, __( ‘My Meta Box’, ‘my_textdomain’ ), // Title ‘my_callback_function’, // Callback function that renders the content of the meta box ‘post’, // Admin page (or post type) to show the meta box on ‘side’, // Context … Read more

Can WordPress handle these functionalities?

I really like BuddyPress for interactive communities, so I tend to go overkill and use it for anything that might possibly evolve to need its functionality in the future. Combine it with an events plugin like Buddyvents or EventPress to create a much richer user experience than you’d have with just an events plugin alone. … Read more

Show list of loaded php files from plugins

In setup, set the plugin folder root: $this->plugin_root = wp_normalize_path( WP_PLUGIN_DIR ); Then modify filter to check if file is in theme root or plugin root: return $this->switch && ( strpos($norm, $this->root) === 0 || strpos($norm, $this->plugin_root) === 0 ); or to show all included files, don’t filter any of the results in grab: return … Read more

Use comments as notes, visible for comment author only

I used _s as a template. The comments are loaded with wp_list_comments( array( ‘callback’ => ‘_s_comment’ ) ); and then comments are styled with _s_comment(). That is what you will use. You can use get_current_user_id() to get the current user id. $current_user_id = get_current_user_id(); You can get the user id of the commenter with $comment->user_id. … Read more

How to call a function in wordpress plugin from another site

There are two way you can implement this 1. Use the AJAX API This is the fastest way of doing it. Just register an ajax action and use that action url to send requests. Example add_action(‘wp_ajax_api-call’, ‘wpse_156943_ajax_api_handle_request’); function wpse_156943_ajax_api_handle_request(){ // security check validation // do whatever you want to do } The url for the … Read more

Check out Attribute on WooCommerce

As it happens, I just blogged about this yesterday, for how to add a subscribe to mailing list checkbox. The key points are: look at the WooCommerce tutorial woocommerce_checkout_fields is a filter hook that allows you to add or modify what fields appear on the checkout form woocommerce_checkout_update_order_meta is an action hook that allows you … Read more