__('Classic - with sharing counter', 'ak-sharing-buttons'), 'static-links' => __('Static links (loading fastest - recommended)', 'ak-sharing-buttons') ); ?> is_main_query() && is_singular('post')){ add_filter('the_content', array($this, 'add_buttons_wrap')); } } /* * Check current page is post, page, (a singular object). * Remove filter the_content / add_buttons_wrap after fire it. */ public function loop_end($query){ if($query->is_main_query() && is_singular('post')){ remove_filter('the_content', array($this, 'add_buttons_wrap')); } } /* * Add a div with ID:aksb-buttons-wrap, * with jquery event window.load(), a ajax request will be get sharing buttons and fill to this element. */ public function add_buttons_wrap($content){ if(!empty($content)){ $style = get_option('aksb_style', 'static-links'); switch ($style) { case 'classic': $content .= $this->get_layout_classic(); break; default: $content .= $this->get_layout_static_links(); break; } } return $content; } public function get_layout_classic(){ ob_start(); ?>
ID; $post_url = get_permalink($post_id); $post_title = get_the_title($post); $post_name = get_post_field('post_name', $post); ob_start(); ?> admin_url('admin-ajax.php'), 'post_id' => is_singular() ? get_queried_object_id() : 0 )); } }