Welcome! To use this support forum, please Login or Join Today!

   

New Widget Area on Home Page?

{name}
Rank

Total Posts: 16

Joined 2011-05-09

PM

 
I'd love to be able to have a magazine or blog post style as my home page.

If I could add a widget area at the top of this page and add custom copy specific to this page that would be huge.

Any way to add that function as part of the themes? It would also be great for SEO. In my recent research Google really likes this format.
{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
The above content widget location is a great suggestion.
The magazine post style wouldn't be hard to implement. Actually it's already done in some themes, I just need to take the time to add to the UI, add options for number of columns, featured image size, etc.

Which theme are you using? I can probably point you in the right direction or push an update depending on your needs.
{name}
Rank

Total Posts: 16

Joined 2011-05-09

PM

 
I'm using Presstige and would love to implement this on http://www.davidlupberger.com
Check out another client I've been working with http://www.stellarhomes.com using the Presstige theme
{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

I'd love to be able to have a magazine or blog post style as my home page.


When you say "magazine style" on your home page, is that not what you already have in a way? When I think "magazine" style, I think multiple balanced columns of dynamic blog Posts - not so much static informational Page content.

Do you mean a magazine style blog as opposed to http://davidlupberger.com/index.php/contractor-blog/ ?

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 
Edit: this turned out to be a longer post than I intended, so I've added it to the repository as well - if you prefer.
-----------------------------------------------------------------------------------------

As for adding a new widget position, it's pretty simple. I walk you through it in a way that will not conflict with future updates.

FTP into your wp-content/themes/presstige folder and open lib/functions/widgets_functions.php.

CUT (not copy) everything from line#2 down to (around line#100) just before:

/// Ads Widget


Now create a new file named widgets.php in the theme root and add the code you just removed from widgets_functions.php:

<?php
// PASTE CUT WIDGETS CODE HERE
?>


Now, open functions.php and add this line (anywhere):

// Register Widgets
require_once (STYLESHEETPATH . '/widgets.php');


This is one of the new methods we're using in the update API which will allow you to separate the core widgets from your widgets locations - allowing you to add custom postions without the risk of losing them in an update.

Be sure to save functions.php and widgets_functions.php before you reload your widgets admin panel.

Now that this is done, you can add a custom widget location to the bottom of widgets.php. We put this in the theme root so you can access it from the theme editor (Appearance → Editor) anytime you want. The important thing here is to add your new widget locations to the bottom of widgets.php. This is so your widget ID's don't get out of order. If you try to make it organized, things could get out of whack and WordPress will assign existing widget to the same widget location ID. Sometimes this freaks some people out because they think their widgets were deleted, but they are actually just moved to the "Inactive Widgets" area at the bottom. and they will need to be dragged back in their proper location. It's up to you how you do this, but the safest way to register a new widget location is just add them to the bottom.

Now, to add a new location. Just copy from the existing code to add a new location.


For example, say you wanted to load an "Above Blog Home" announcement widget on your blog home page.

register_sidebar(array(
  'name' => 'Above Blog Home',
 'id' => 'above-blog-home',
 'description' => 'Widget location loaded above content.',
 'before_widget' => '<div class="widget %2$s"><div class="inside">',
 'after_widget' => '</div></div>',
 'before_title' => '<h3>',
 'after_title' => '</h3>',
));


Using the method above, you can load this widget into the template (home.php) using this code:

<?php if (is_active_sidebar('above-blog-home'))
 dynamic_sidebar('above-blog-home');
?>