init() public static method

Creates and returns a static instance of Jetpack_RelatedPosts.
public static init ( ) : Jetpack_RelatedPosts
return Jetpack_RelatedPosts
Example #1
0
function wptouch_remove_jetpack_related()
{
    if (class_exists('Jetpack_RelatedPosts')) {
        $jprp = Jetpack_RelatedPosts::init();
        remove_filter('the_content', array($jprp, 'filter_add_target_to_dom'), 40);
    }
}
Example #2
0
 /**
  * This action triggers if the module is in an active state, load related posts and options.
  *
  * @uses Jetpack_RelatedPosts::init, is_admin, Jetpack::enable_module_configurable, Jetpack::module_configuration_load, Jetpack_Sync::sync_posts
  * @return null
  */
 public function action_on_load()
 {
     require_once 'related-posts/jetpack-related-posts.php';
     Jetpack_RelatedPosts::init();
     if (is_admin()) {
         // Enable "Configure" button on module card
         Jetpack::enable_module_configurable(__FILE__);
         Jetpack::module_configuration_load(__FILE__, array($this, 'module_configuration_load'));
     }
 }
Example #3
0
function jetpackme_remove_rp()
{
    $jprp = Jetpack_RelatedPosts::init();
    $callback = array($jprp, 'filter_add_target_to_dom');
    remove_filter('the_content', $callback, 40);
}
 function test_remove_related_posts_shortcode_from_filtered_content()
 {
     require_once JETPACK__PLUGIN_DIR . 'modules/related-posts.php';
     require_once JETPACK__PLUGIN_DIR . 'modules/related-posts/jetpack-related-posts.php';
     Jetpack_RelatedPosts::init()->action_frontend_init();
     $this->post->post_content = '[jetpack-related-posts]';
     wp_update_post($this->post);
     $this->assertContains('<!-- Jetpack Related Posts is not supported in this context. -->', apply_filters('the_content', $this->post->post_content));
     $this->sender->do_sync();
     $synced_post = $this->server_replica_storage->get_post($this->post->ID);
     $this->assertEquals("\n", $synced_post->post_content_filtered);
 }
Example #5
0
 function remove_related_posts_from_content()
 {
     if ($this->jetpackInstalled()) {
         $jprp = Jetpack_RelatedPosts::init();
         remove_action('wp', array($jprp, 'action_frontend_init'), 10);
         remove_filter('the_content', array($jprp, 'filter_add_target_to_dom'), 40);
     }
 }
Example #6
0
/**
 * Remove the related posts from below the content area.
 * 
 * @package lsx
 * @subpackage jetpack
 * @category portfolio
 */
function lsx_remove_single_portfolio_related_posts()
{
    if (is_single() && 'jetpack-portfolio' == get_post_type() && class_exists('Jetpack_RelatedPosts')) {
        $jprp = Jetpack_RelatedPosts::init();
        $callback = array($jprp, 'filter_add_target_to_dom');
        remove_filter('the_content', $callback, 40);
    }
}