From the category archives:

Blogging

Widgetize the Footer

March 25, 2009

I came across another excellent thread in the DIY forums on how to add sidebars and widgetize the footer. I’ve adapted it to meet my needs and thought I would share it.

I’ve added 4 sidebars to the footer. Each one is 25% the width of the footer. The function is hooked directly into the footer. Here’s the code.

/*widgetize the footer */
if ( function_exists('register_sidebar') ) register_sidebars(4,array('name'=>'Footer-Sidebar %d', 
      'before_widget' => '<li class="widget %2$s" id="%1$s">',
      'after_widget' => '</li>',
      'before_title' => '<h3>',
      'after_title' => '</h3>'
    )
  );

function footer_widget(){?>
<div id="footer-sidebar">
   <div id="footer-sidebar1">
     <?php if ( !function_exists('dynamic_sidebar')
      || !dynamic_sidebar('Footer-Sidebar 1') ) : ?>
     <?php endif; ?>
   </div>
   <div id="footer-sidebar2">
     <?php if ( !function_exists('dynamic_sidebar')
      || !dynamic_sidebar('Footer-Sidebar 2') ) : ?>
     <?php endif; ?>
   </div>
   <div id="footer-sidebar3">
     <?php if ( !function_exists('dynamic_sidebar')
      || !dynamic_sidebar('Footer-Sidebar 3') ) : ?>
     <?php endif; ?>
   </div>
   <div id="footer-sidebar4">
     <?php if ( !function_exists('dynamic_sidebar')
      || !dynamic_sidebar('Footer-Sidebar 4') ) : ?>
     <?php endif; ?>
   </div>

</div> <!-- Close footer-sidebar -->
<div style="clear-both"></div>
<?php
}
add_action('thesis_hook_before_footer','footer_widget');

Footer-Sidebars 1,2,3 and 4 will now be accessible on the Widgets page in WordPress.

Note the new divs that were added:
footer-sidebar – This div holds the sidebars in the footer div.
footer-sidebar1
footer-sidebar2
footer-sidebar3
footer-sidebar4

Here’s the code I added for the footer sidebars in the custom.css.

/*footer widgets*/
#footer-sidebar { display:block; width:100%; height: 125px; list-style-type: none;float:left;text-align:left;}
#footer-sidebar h3{ color: #3A93CC; font-weight: bold;text-decoration: underline;line-height:1.5em;}
#footer-sidebar a {color:#000;border:none;}
#footer-sidebar a:hover{text-decoration:underline;}
#footer-sidebar1{float:left; width:25%;text-align:left;}
#footer-sidebar2{float:left; width:25%;text-align:left;}
#footer-sidebar3{float:left; width:25%;text-align:left;}
#footer-sidebar4{float:left; width:25%;text-align:left;}

If you only want 2 or 3 sidebars in the footer, just adjust the code to fit your needs.

{ 4 comments }

Custom Search Box

March 15, 2009

The nice thing about this function is that you can place it just about anywhere with the thesis hooks. I have mine after the multimedia box, because I sometimes put both sidebars on the right and like having the search box above the other widgets.

/*Custom Search Box */
function search_up() {
<div class="sidebar">
<ul class="sidebar_list">
  <li class="widget special_search"></li>
</ul>
</div>
add_action('thesis_hook_after_multimedia_box', 'search_up');

{ 0 comments }

Custom Archives

March 15, 2009

Thesis comes with a default archive page. It’s fine, but I wanted mine to show more. I found out how to accomplish it via the DIY Forums and the WordPress Codex. Here’s the code to add to the custom_functions.php:

/* Custom Archives Page */
function my_archive() {
?>
<div class="archive">
<div class="archivel">
  <h3>By Month:</h3>
  <ul>
    <?php wp_get_archives('type=monthly'); ?>
  </ul>
  <h3>By Category:</h3>
  <ul>
    <?php wp_list_categories('sort_column=name&title_li='); ?>
  </ul>
   <h3>By Tag:</h3>
 <?php wp_tag_cloud('smallest=10&largest=10&format=list'); ?>
</div>
<div class="archiver">
   <h3>By Post: (Last 100 articles)</h3>
   <ul>
     <?php wp_get_archives('type=postbypost&limit=100'); ?>
   </ul>
</div>
</div>
<?php
}
remove_action('thesis_hook_archives_template', 'thesis_archives_template');
add_action('thesis_hook_archives_template', 'my_archive');

  1. Next go into your WordPress dashboard and create a new page.
  2. Name that page “Archives” and choose the “Archives” template.
  3. Publish the page.
  4. Now go to the “Thesis Options” page under “Appearance.”
  5. Go to the “Navigation Menu” and click on “Archives” to include it in the nav menu.
  6. Click on the “Big Ass Save Button.”

That’s it!

{ 0 comments }

I would be lost without the Maintenance Mode plugin. This allows you to show a splash page giving visitors an estimated time to check back.

maintenancemode2
When I first got Thesis, I was excited that I could add pictures of my grandkids to my personal blog. The only thing was it wasn’t a slideshow. When I learned how to widgetize the multimedia box, I also got the NextGEN Gallery plugin. This is a great plugin that is very customizable. Now I’m in Granny Heaven!

Akismet comes with WordPress and is a good deterrent for spam. I soon found that it wasn’t enough though. Thanks to the DIY Forums, I found Raven’s Antispam and the Simple Trackback Validation plugins. With these 3 plugins running, I haven’t had to worry about spam comments.

Thesis OpenHook is great plugin from KingdomGeek. Instead of adding custom code in the custom_functions. php, you can add it using the plugin. It also allows you to view and edit the custom.css. This one is on my to-do list to learn more about.

{ 0 comments }