Jetpack_RelatedPosts::action_frontend_init PHP Method

action_frontend_init() public method

Load related posts assets if it's a elegiable front end page or execute search and return JSON if it's an endpoint request.
    public function action_frontend_init()
    {
        // Add a shortcode handler that outputs nothing, this gets overridden later if we can display related content
        add_shortcode(self::SHORTCODE, array($this, 'get_target_html_unsupported'));
        if (!$this->_enabled_for_request()) {
            return;
        }
        if (isset($_GET['relatedposts'])) {
            $excludes = array();
            if (isset($_GET['relatedposts_exclude'])) {
                $excludes = explode(',', $_GET['relatedposts_exclude']);
            }
            $this->_action_frontend_init_ajax($excludes);
        } else {
            if (isset($_GET['relatedposts_hit'], $_GET['relatedposts_origin'], $_GET['relatedposts_position'])) {
                $this->_log_click($_GET['relatedposts_origin'], get_the_ID(), $_GET['relatedposts_position']);
                $this->_previous_post_id = (int) $_GET['relatedposts_origin'];
            }
            $this->_action_frontend_init_page();
        }
    }