Posts tagged as:

widget

Twitter Widget

March 14, 2009

Another great tutorial from Kristarella is her twitter widget. You don’t need to download a twitter plugin in order for it to work.

/*Twitter Widget*/
function footer_scripts() { ?>
  <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
  <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/allaboutshae.json?callback=twitterCallback2&count=2"></script>
<?php }
add_action('thesis_hook_after_html', 'footer_scripts');

function twitter_widget() { ?>
  <li class="widget">
      <div id="twitter_div"><ul id="twitter_update_list"><li> </li></ul><img src="<?php bloginfo('template_url'); ?>/custom/images/twitter_48.png" alt="" /></div>
    <p><a href="YOUR TWITTER ADDRESS GOES HERE>tweet with me</a></p>
  </li>
<?php }
add_action('thesis_hook_after_multimedia_box', 'twitter_widget',1);

Next is to customize the widget. Here’s an example of how I have mine coded.

#twitter_div {margin-left:1em;}
  #twitter_div img {float:right;}
  li.widget #twitter_update_list{list-style:none;}
  #twitter_div a{color:#3A93CC;}
  li.widget p a{color:#3A93CC;margin-left:1em;}

{ 0 comments }

Thesis comes with a multimedia box that enables you to add rotating images, video, or custom code to it. I had never used it for anything other than images until I came across a post by Adam Barber on the DIY Forums. He had created a custom function that would enable the multimedia box to hold widgets like the sidebars. Once the custom code was activated, the media box was accessible via the Widgets page just like the sidebars. Any widget that you can add to the sidebars can be added to the media box.

Here’s the code:

/*widgetized the multi-media box */
if ( function_exists('register_sidebar') ) register_sidebar(array('name'=>'Media Box', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', ));

function mediabox_widget() { if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Media Box') ) : endif; }
add_action('thesis_hook_multimedia_box', 'mediabox_widget');

{ 0 comments }