Including comments meta box on a plugin page

You can also use add_meta_box to add predefined boxes to different places in the admin, as long as you know the right handles. In the case of the comments meta box you need: add_meta_box(‘commentsdiv’, __(‘Comments’), ‘post_comment_meta_box’, $screen, ‘normal’); Here post_comments_meta_box is the callback function that fills the metabox. I am supposing your plugin is setting … Read more

Howto check version of another plugin and then add a submenu page to it

Ok i got it. The solution is to use an earlier hook for checking plugins. But then the function get_plugins() is not available so i have to include it for using. The working code: class acf_multisite_sync { function __construct() { add_action(‘plugins_loaded’, array($this, ‘acf_sync_init’)); } function acf_sync_init() { if (!function_exists(‘get_plugins’)) { require_once ABSPATH . ‘wp-admin/includes/plugin.php’; } … Read more

Trying to code a simple plugin, infinite loop?

Take a closer look at add_settings_field(); your callback is the same as of add_options_page(). You’ve already set up your input function. Just change site_quotes_output_settings to site_quotes_main_create_input and everything should be fine: add_settings_field( ‘sometext’, ‘Some text!’, ‘site_quotes_main_create_input’, ‘site_quotes_plugin’, ‘site_quotes_settings_section’ );

How to create a custom shortcode based on the layout?

You need to capture the attributes that passed to a shortcode. You can do that like this add_shortcode(‘testimonial’, ‘testimonial_shortcode_func’); function testimonial_shortcode_func( $atts ) { $atts = shortcode_atts( array( ‘style’ => ‘default_value_if_no_value_is_provided’, ), $atts ); if( $atts[‘style’] == ‘fancy’ ) { //do something } else if ( $atts[‘style’] == ‘something_else’ ) { //do something } //And … Read more