Tagged: widget RSS Toggle Comment Threads | Keyboard Shortcuts

  • Ankit 4:11 pm on May 4, 2012 Permalink | Log in to leave a Comment
    Tags: , , , widget,   

    My amazing wordpress widget with google search shopping API 

    Hello guys,
    This time I got my hands wet with Google shopping Search API. ;)

    I read about this api yesterday and thought that I should try to implement this API functionality in my wordpress widget.

    The Search API for Shopping is intended for developers who want to programmatically query data that has been uploaded to Google via the Google Merchant Center.

    The Search API for Shopping targets the following use cases:

    1) Developers can build applications that query product offers across merchants.
    2) Merchants can use the API to query their own data by becoming a Commerce Search user.
    3) Publishers in the Google Affiliate Network can use the API to access product offers from their advertisers of choice.

    In fact this API is too much extensive to it’s scope and can be very useful to the sites which are mainly intended towards the product search for consumers, also it can be very useful to more revenue generation because with the help of this API you can programatically display any offers and products from a perticular publisher.

    All the above mentioned stuff was intro (or you can also call it a speech if you wish so.. ;) ) about the Search API for shopping.

    now it’s time to get practical:->
    You can copy and paste the following code to create custom widget implementing google shopping api.

    /******************** Code Starts Here *************************************/
    function widget($args, $instance){
    extract($args, EXTR_SKIP);

    echo $before_widget;
    $title = empty($instance['title']) ? ‘ ‘ : apply_filters(‘widget_title’, $instance['title']);
    $api_key = $instance['api_key'];
    $search_q = $instance['search_q'];
    $by_brand = $instance['by_brand'];
    $results_to_show = $instance['results_to_show'];

    if(empty($results_to_show)){
    $results_to_show = 6; /* Default results to show is 6 */
    }

    $get_search_q = explode(‘ ‘, $search_q);

    if(count($get_search_q)>1){
    $more_term = 1;
    }
    //$product_url = ‘https://www.googleapis.com/shopping/search/v1/public/products?key=’.trim($api_key).’&country=US&q=netbook’;

    $product_url = ‘https://www.googleapis.com/shopping/search/v1/public/products?key=’;
    if($api_key && $search_q){
    $product_url .= trim($api_key).’&country=US&q=’;

    if(isset($more_term)){

    for($p=0;$p1){
    $more_brands = 1;
    }
    }

    /* If brands are present and more than one */
    if(isset($more_brands)){

    for($p=0;$pitems as $key=>$val){
    array_push($img_arr,$val->product->images[0]);
    array_push($title_arr,$val->product->title);
    array_push($inventory_arr,$val->product->inventories[0]);
    }
    //print_r($img_arr[0]->link);
    //exit;
    if (!empty($title))
    echo $before_title . $title . $after_title;

    if(count($title_arr)){
    if(count($title_arr)>$results_to_show){
    $result_to_display = $results_to_show;
    }else
    $result_to_display = count($title_arr);
    ?>

    <?php for($i=0; $i

    <img alt="img-” title=”" src=”link; ?>”/>

    <?php }
    }
    echo $after_widget;
    }

    }

    function rtp_child_register_widgets() {
    register_widget( 'google_shop_widget' );
    }
    add_action( 'widgets_init', 'rtp_child_register_widgets', 11 );

    /******************** Code Ends Here *************************************/

    you can make your widget as much extensible as you wish it to be.

    Currently it will ask you title for widget, what products (one or more) to search, which brands to search (optional) and number of results to display on widget.

    there is one more option for API key it's because u hav to register urself for using google API's for getting access to API through API key.

    You can also watch out my working example at http://ankit.rtcamp.info

    Hope this will be helpful to you all any point of time.
    ( Do not forget to vote if you like it :) )
    Thanks :)

    VN:F [1.9.17_1161]
    Rating: +1 (from 1 vote)
     
  • Radhe 6:47 pm on December 14, 2011 Permalink | Log in to leave a Comment
    Tags: shiba, widget   

    Shiba Widgets 1.5 

    The Shiba Widgets plugin allows you to assign different widgets to different posts, pages, categories, or tags.

    http://shibashake.com/wordpress-theme/shiba-widgets-1-5

    VN:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
     
    • Abhimanyu 2:02 pm on February 14, 2012 Permalink | Log in to Reply

      This widget has a disadvantage too, sir. It makes the footer widgets dynamic too. That is, If we have a static footer to show up 3 widgets on every page, we have to set the footer widgets separately for each of the ‘widget sets’ we create and set the ‘widget set’ accordingly for each of the pages.

  • sameer.joshi 6:02 pm on November 7, 2011 Permalink | Log in to leave a Comment
    Tags: , , popular posts, , widget   

    KR Popular Posts displays a horizontal graph that represents the popularity of a post based on comments, views, ratings, facebook likes and retweets. Ratings are measured only if GD Star Rating plugin is installed and active. Views look for a “views” custom field and assumes it is tracking the views of the page so any plugin that stores view count using “views” as the post meta will work ( future update will allow you to specify the custom field to use). Facebook likes and retweets require you to setup an hourly cronjob to fetch likes and retweet values for your posts from facebook and twitter. Post popularity is shown with a horizontal bar graph below the post if you check “Use content filtering to append popularity graph”. Otherwise you can manually insert the function code where you prefer within your post template page. You can also show a list under the main post popularity graph which displays a graph for the individual item percentages (ie views, ratings, comments, retweets, facebook likes) by checking “Show itemized popularity graphs under main graph”. A post’s overall popularity and itemized popularity value will rise or fall in relation to the other posts on your site. That means a post with a 50% popularity rating today can have a 30% popularity rating next week if another post increases in views, comments, ratings, retweets, facebook likes by a large enough number to push down the value of the example post’s popularity rating. Includes a popular posts widget, with thumbnails or without thumbnails, for your sidebar.

    http://wordpress.org/extend/plugins/knowledgering-post-popularity-graph-tool/

    VN:F [1.9.17_1161]
    Rating: 0 (from 0 votes)
     
  • Santosh 12:14 pm on December 17, 2010 Permalink | Log in to leave a Comment
    Tags: shortcode, widget   

    enable shortcodes in widgets

    // shortcode in widgets
    if ( !is_admin() ){
    add_filter(‘widget_text’, ‘do_shortcode’, 11);
    }

    VN:F [1.9.17_1161]
    Rating: +1 (from 1 vote)
     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel