Support » Plugin: AmazonSimpleAdmin » Sidebar widget collection depending on article

Viewing 3 replies - 1 through 3 (of 3 total)
  • vguna


    I managed it via a little bit coding.

    I’ve created a text widget and entered the following code:

    global $post;

    The widget will show a collection which name is post_<postid>. So for a post with the id 5 it will display the collection with the name post_5.

    To test whether a collection exists for the post, and whether to display the widget at all, I’m using the plugin WidgetLogic.

    For the condition I set:

    is_single() && asa_existing_post_collection()

    The configured condition calls a custom function that I added to my wordpress installation:

    function asa_existing_post_collection() {
            global $post, $asa;
            $exist = $asa->getCollection('post_'.$post->ID,'all','sidebar_item');
            return $exist!='';

    This allows me to show collections depending on a current post in the sidebar.

    The only caveat is: it has to render the collection twice. Once for the WidgetLogic and 2nd when displayed.

    I couldn’t find a suitable public method to test for collections within amazon simple admin. Maybe one could be implemented in the future? Also it would be nice if one could specify the number of items to display when invoking asa via php directly.

    Plugin Author Timo Reith


    Great solution.
    I will provide a method to check if a collection exists with the next update. When the dev version is in the SVN I’ll inform you.



    Great thanks! Will the item count also be supported then :-)?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sidebar widget collection depending on article’ is closed to new replies.