/** * Function to decide whether buttons can be output or not * @param boolean $cando default true * @return boolean false if not a singular post (can be modified for other content types) */ protected function can_do_buttons($cando = true) { if (!is_main_query()) { $cando = false; } $post_types = scriptlesssocialsharing_post_types(); $is_disabled = get_post_meta(get_the_ID(), '_scriptlesssocialsharing_disable', true) ? true : ''; if (!is_singular($post_types) || is_feed() || $is_disabled) { $cando = false; } return apply_filters('scriptlesssocialsharing_can_do_buttons', $cando); }
/** * Add a custom post metabox. */ public function add_meta_box() { $this->post_types = scriptlesssocialsharing_post_types(); add_meta_box('scriptless_social_sharing', __('Scriptless Social Sharing', 'scriptless-social-sharing'), array($this, 'do_metabox'), $this->post_types, 'side', 'low'); add_action('admin_enqueue_scripts', array($this, 'enqueue')); }