Customizing Homepage


I have just upgraded to 2.1.2. My homepage (themes/default/index.php) isn't working quite right. It displays everything as one column, though the code says two. When I try to customize it and move it to my theme (themes/berlin/index.php), it only displays the homepage text, and loses all the rest of the featured and recent items. Here's the site:

And the code:

<?php echo head(array('bodyid'=>'home', 'bodyclass' =>'two-col')); ?>
<div id="primary">
    <?php if ($homepageText = get_theme_option('Homepage Text')): ?>
    <p><?php echo $homepageText; ?></p>
    <?php endif; ?>
$tags = get_tags(array('sort' => 'alpha'), 50);
echo tag_cloud($tags, uri('items/browse'));
    <?php if (get_theme_option('Display Featured Item') == 1): ?>
    <!-- Featured Item -->
    <div id="featured-item">
        <h2><?php echo __('Featured Item'); ?></h2>
        <?php echo random_featured_items(1); ?>
    </div><!--end featured-item-->
    <?php endif; ?>
    <?php if (get_theme_option('Display Featured Collection')): ?>
    <!-- Featured Collection -->
    <div id="featured-collection">
        <h2><?php echo __('Featured Collection'); ?></h2>
        <?php echo random_featured_collection(); ?>
    </div><!-- end featured collection -->
    <?php endif; ?>
    <?php if ((get_theme_option('Display Featured Exhibit')) && function_exists('exhibit_builder_display_random_featured_exhibit')): ?>
    <!-- Featured Exhibit -->
    <?php echo exhibit_builder_display_random_featured_exhibit(); ?>
    <?php endif; ?>

</div><!-- end primary -->

<div id="secondary">
    <!-- Recent Items -->
    <div id="recent-items">
        <h2><?php echo __('Recently Added Items'); ?></h2>
        $homepageRecentItems = (int)get_theme_option('Homepage Recent Items') ? get_theme_option('Homepage Recent Items') : '4';
        set_loop_records('items', get_recent_items($homepageRecentItems));
        if (has_loop_records('items')):
        <ul class="items-list">
        <?php foreach (loop('items') as $item): ?>
        <li class="item">
            <h3><?php echo link_to_item(); ?></h3>
            <?php if($itemDescription = metadata('item', array('Dublin Core', 'Description'), array('snippet'=>150))): ?>
                <p class="item-description"><?php echo $itemDescription; ?></p>
            <?php endif; ?>
        <?php endforeach; ?>
        <?php else: ?>
        <p><?php echo __('No recent items available.'); ?></p>
        <?php endif; ?>
        <p class="view-items-link"><?php echo link_to_items_browse(__('View All Items')); ?></p>
    </div><!-- end recent-items -->

    <?php fire_plugin_hook('public_home', array('view' => $this)); ?>

</div><!-- end secondary -->
<?php echo foot(); ?>

Should I still be saving my index.php file at the root of my theme? Is the index.php file still the one that controls the theme?

Thanks so much!

Ah...might be some different mixups. First, despite the name default in the theme folder, that doesn't contain the default _templates_. Instead, it contains the default _theme_, Thanks, Roy.

The default templates are in /application/views/scripts/. Those are the ones that are overridden by the parallel ones in the themes. For example /berlin/items/show.php overrides /application/views/scripts/items/show.php

Berlin comes with its own index.php file, so that's the one to edit.

All that still doesn't explain the missing columns, though.

When I look at the source of your homepage, somewhere something seems out of alignment. In the source, the CSS class for two columns isn't there, and the primary div is missing, too, even though it's there in the PHP you have above.

So, I'd double check that the berlin/index.php file is the one that came with Berlin -- it should still be in the root, and it is the file that controls the homepage, not the entire theme.

Thank you so much!! This worked perfectly. I guess I was just completely mixed up on the default file!