I think that widgets might be your best bet. There is a great tutorial here. on creating them.
In your scenario, I would create multiple html lists in Page Template. You would then need to register these lists as widgets in your functions.php file. FYI – Widgets do not have to be limited to a “sidebar” as a sidebar is basically an unordered list as far as WordPress Core sees understands it.
Hopefully this will lead you in the right direction!
-Mike
Thread Starter
matius
(@matius)
Mike, thanks for the tip! I will check into it.
Thread Starter
matius
(@matius)
Mike, are you saying that I would need to register the widgets separately because the sidebar is already registered?
Reason I’m asking is because I just went through a widget tutorial & didn’t need to register them in functions.php at all… function.php confuses me 😉
I’ll take a look through your links again to see if I can find what’s missing.
Thanks again.
Mike, are you saying that I would need to register the widgets separately because the sidebar is already registered?
Opps, I wrote this out incorrectly, you will need to register the lists as “Sidebars” – not “Widgets”… sometimes all this WordPress jargon can get confusing 🙂
Here’s a working Page Template that should allow you to create dynamically editable areas on your home page. You will need to copy this code, paste it into a new file and save as t-homepage.php. Upload this file to your site’s current theme directory.
You can then create a new page in the WordPress Administration Panels and set it’s Page Template to “Frontpage”.
The template below will generate a WordPress loop width 2 widgetized regions below it.
Hope this Helps,
Mike
<?php
/*
Template Name: Frontpage
Author: Michael Fields
License: GPL 2
*/
/* Register widgetized area with WordPress */
register_sidebar( array(
'name' => __( 'Homepage 1', $platypus->locale ),
'id' => __( 'homepage_1' )
) );
register_sidebar( array(
'name' => __( 'Homepage 2', $platypus->locale ),
'id' => __( 'homepage_2' )
) );
/* Helper function which prints a single widgetized area. */
function mf_custom_sidebar( $id ) {
print "\n\n" . '<div id="' . $id . '">';
print "\n\t" . '<ul>';
dynamic_sidebar( $id );
print "\n\t" . '</ul>';
print "\n\t" . '</div>';
}
get_header();
print '<div id="content">';
/* WordPress Loop Condensed. */
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
the_title( '<h1>', '</h1>' );
the_content();
comments_template();
}
print '<div class="clear"></div>';
}
/* Create as many Widgetized Areas Here. */
mf_custom_sidebar( 'homepage_1' );
mf_custom_sidebar( 'homepage_2' );
print '</div>';
get_sidebar();
get_footer();
?>
Matius, I don’t know if mfields solved your problem or not. I am not quite clear on what you want. If you just want a static front page with posts from several different categories on it, you can do that with multiple loops in a template.
Take a look at BluegrassMiataClub.com. It has a static front page with a ‘Welcome’ section at the top. Then there are three category sections below: ‘Message From Our Club’, ‘Monthly Meetings’, and ‘Down The Road’. Each category section shows the most recent post in its category, but it could easily show more than one.
If this seems like what you want to do, use the About->Contact Us form to email me – Mac McDonald, and I will be glad to try to answer questions about the site.
Thread Starter
matius
(@matius)
Thanks vtxyzzy, all I’m trying to do is organize my home page differently than the inside pages (using WP as a CMS).
So basically, I need to create new editable content sections for the home page, that won’t appear on the inside pages.
So if an inside page has an article and a sub nav, the home page will a more narrow welcome text and 4 different other sections.
Mike, thanks for the code. I think I see what’s going on there…
Thread Starter
matius
(@matius)
I guess my question would be (and forgive if it’s plain obvious) how I populate the widgets… by creating a new file for each I create?
Thread Starter
matius
(@matius)
Oh, I see you have to add the registers to functions.php to get this working.
Can these be removed from t-homepage.php?
Oh, I see you have to add the registers to functions.php to get this working.
Can these be removed from t-homepage.php?
Yep. If you add them to functions.php you should be able to add widgets in you admin. Sorry for the oversight on my part.
Thread Starter
matius
(@matius)
No worries man, this has saved my day. Thanks so much – awesome code!
No problem, glad it worked out for you!