WordPress.org

Plugin Directory

Changeset 1614808 for event-post


Ignore:
Timestamp:
03/15/17 09:44:09 (8 days ago)
Author:
bastho
Message:

Correctly checks for content filtering, as mentionned in https://developer.wordpress.org/reference/hooks/the_content/#usage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • event-post/trunk/eventpost.php

    r1596434 r1614808  
    802802     */ 
    803803    public function display_single($content) { 
    804         if (is_page() || !is_single() || is_home()) 
     804        if (is_page() || !is_single() || is_home() || !in_the_loop() || !is_main_query()){ 
    805805            return $content; 
    806         $post = get_queried_object(); 
    807         //Prevent from filters applying "the_content" on another thing than the current post content 
    808         remove_filter('the_content', array(&$this, 'display_single'), 9999); 
    809         $current_content = apply_filters('the_content', $post->post_content); 
    810         if ($current_content == $content) { 
    811             $post = $this->retreive(); 
    812             $eventbar = apply_filters('eventpost_contentbar', $this->get_single($post, 'event_single', 'single'), $post); 
    813             if($this->settings['singlepos']=='before'){ 
    814                 $content=$eventbar.$content; 
    815             } 
    816             elseif($this->settings['singlepos']=='after'){ 
    817                 $content.=$eventbar; 
    818             } 
    819         $this->load_map_scripts(); 
    820         } 
    821         add_filter('the_content', array(&$this, 'display_single'), 9999); 
     806        } 
     807 
     808        $post = $this->retreive(); 
     809        $eventbar = apply_filters('eventpost_contentbar', $this->get_single($post, 'event_single', 'single'), $post); 
     810        if($this->settings['singlepos']=='before'){ 
     811            $content=$eventbar.$content; 
     812        } 
     813        elseif($this->settings['singlepos']=='after'){ 
     814            $content.=$eventbar; 
     815        } 
     816        $this->load_map_scripts(); 
    822817        return $content; 
    823818    } 
Note: See TracChangeset for help on using the changeset viewer.