Forums

Widget Entries
post type not reported for use in filtering (1 post)

  1. stevemagruder
    Member
    Posted 6 months ago #

    First, thanks for a great plugin!

    I wanted to filter out AddThis buttons from displaying at the bottom of widget entries, as AddThis (I guess properly) sees them as posts.

    In this process, I found out that get_post_type() returns a blank for widget entries while returning 'post' for posts and 'page' for pages. I was expecting to see a type of 'pt-widget'.

    For now, I can check against a blank (''), but for the long term, it would probably be best if 'pt-widget' could be returned.

    My code:

    add_filter('addthis_post_exclude', 'my_addthis_post_exclude_filter');
      function my_addthis_post_exclude_filter($display)
      {
        if ( get_post_type() == '' )  // widget entries
          $display = false;
    
        return $display;
      }

    http://wordpress.org/extend/plugins/widget-entries/

Reply

You must log in to post.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 6 months ago by stevemagruder
  • This topic is not resolved
  • WordPress version: 3.2.1