• Forget the problem reported below, it seems the problem is regarding

    add_filter('the_excerpt', array(&$this, 'remove_post_views_count'));

    I need to see why that is being called since I’m just using the_content.

    Thanks.

    ======
    Hi, thanks for the plugin, it’s really helpful.

    I’m having a specific problem which I can workaround calling the methods directly but still should be taken care of anyway.

    Basically, the shortcode is colliding with others because of what’s explained here: http://codex.ww.wp.xz.cn/Shortcode_API#Hyphens
    Using post_views (changing the hyphen) as shortcode solves it.

    Cheers,
    Guillermo

    https://ww.wp.xz.cn/plugins/post-views-counter/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gbonvehi

    (@gbonvehi)

    Well, after a quick review, I saw that inside *remove_post_views_count* method you’re besides removing the tag from the excerpt, also deregistering the shortcode, so if in a page you display an excerpt AND a content AFTER it it won’t have the shortcode available.

    89     public function remove_post_views_count($excerpt)
     90     {
     91         remove_shortcode('post-views');
     92         $excerpt = preg_replace ('/\[post-views[^\]]*\]/', '', $excerpt);
     93         return $excerpt;
     94     }

    I’ve removed the remove_shortcode call, I don’t know if that will affect other functionality of the plugin (I guess it shouldn’t), so far it seems to be working fine.

    Plugin Author dFactory

    (@dfactory)

    Guillermo, thank you very much for your in-depth analysys of the issue and the suggestions.

    I must admitt, at the time of writing this part of code I was wondering if this generates any issues or not. Now I have an answer 🙂

    I’ll look at that closely before next plugin update.

    Thanks again,
    Bartosz

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Shortcode hyphen problem’ is closed to new replies.