WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Messed up layout. Please help (5 posts)

  1. Revolution25
    Member
    Posted 4 years ago #

    Hi all,
    I was trying to change something in my sidebar.php this morning and must have deleted something I shouldn't have. I have no idea what I did wrong, but the layout on my site is now all screwed up. Here's a link to the site:
    http://www.themovieknight.com

    I'll post the sidebar.php here and hope someone can see what I did wrong:

    <div id="sidebar">
    
    <?php if (is_home()) { ?>
    
    <?php } ?>
    
    <?php if (is_single()) { ?>
    
    <?php } ?>
    
    <?php if ( !function_exists('dynamic_sidebar')
            || !dynamic_sidebar() ) : ?>
    
    <h2>New Entries</h2>
    <?php $today = current_time('mysql', 1);
    if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 10")): ?>
    <ul>
    <?php foreach ($recentposts as $post) { if ($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
    echo "<li><a href='".get_permalink($post->ID)."'>"; the_title(); echo '</a></li>'; } ?>
    </ul>
    
    <?php endif; ?>
    
    <?php if (function_exists('get_recent_comments')) { ?>
    <li><h2>Newest comments</h2>
    <ul>
    <?php get_recent_comments(); ?>
    </ul>
    </li>
    <?php } ?>
    
    <h2>Categories</h2>
    <ul>
    <?php wp_list_cats('sort_column=name&hierarchical=0'); ?>
    </ul>
    
     <h2>Monthly Archives</h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    
    <?php if (is_home()) { ?>
    <h2><?php _e('Blogroll'); ?></h2>
    <ul>
    <?php get_links(-1, '<li>', '</li>', '', FALSE, 'name', FALSE, FALSE, -1, FALSE); ?>
    </ul>
    <?php } ?>
    
    <h2>Syndication (RSS)</h2>
    <ul>
    <li><a href="<?php bloginfo('rss2_url'); ?>">RSS 2.0 Entries</a></li>
    <li><a href="<?php bloginfo('comments_rss2_url'); ?>">RSS 2.0 Comments</a></li>
    </ul>
    
    <?php function swg_is_admin_logged() {
    // Checks whether admin is logged or not
    global $userdata;
    get_currentuserinfo();
    if ( intval($userdata->user_level) >= 10 ) {
    return true;
    } else {
    return false;
    }
    }?>
    
    <?php
    // Begin: Admin Menu
    if (swg_is_admin_logged()) {
    // Get number of posts
    $adminmenu_numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
    if (0 < $adminmenu_numposts) $adminmenu_numposts = number_format($adminmenu_numposts);
    // Get number of pages
    $adminmenu_numpages = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'static'");
    if (0 < $adminmenu_numpages) $adminmenu_numpages = number_format($adminmenu_numpages);
    // Get number of comments
    $adminmenu_numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
    if (0 < $adminmenu_numcomms) $adminmenu_numcomms = number_format($adminmenu_numcomms);
    echo '<h2>Administration</h2>' . "\n";
    echo '<ul>';
    echo '<li><a title="Write a new Entry" href="/wp-admin/post-new.php">Write a new Entry</a></li>';
    echo '<li><a title="Manage all Entries" href="/wp-admin/edit.php">Manage Entries (' . $adminmenu_numposts . ') </a></li>';
    echo '<li><a title="Manage Comments" href="/wp-admin/edit-comments.php">Manage Comments (' . $adminmenu_numcomms . ') </a></li>';
    echo '<li><a title="Add a Link to your Blogroll" href="/wp-admin/link-add.php">Add a Link</a></li>';
    echo '<li><a title="General settings" href="/wp-admin/options-general.php">General Settings</a></li>';
    echo '<li><a title="Change the looks" href="/wp-admin/theme-editor.php">Theme Editor</a></li>';
    echo '<li><a title="Manage Plugins" href="/wp-admin/plugins.php">Manage Plugins</a></li>';
    echo '<li><a title="Log out of this account" href="/wp-login.php?action=logout">Log out &raquo;</a> </li>';
    echo '</ul>';
    echo "\n" . ' <!-- admin-menu -->' . "\n";
    }
    else
    {
    echo '<h2>Meta</h2>' . "\n";
    echo '<ul>';
    echo '<li><a title="Login to your existing Account" href="/wp-login.php">Login</a></li>';
    echo '<li><a title="Create an Account" href="/wp-login.php?action=register">Register</a></li>';
    echo '<li><a title="No problem!" href="/wp-login.php?action=lostpassword">Lost Password?</a> </li>';
    echo '</ul>';
    echo "\n" . ' <!-- admin-menu -->' . "\n";
    }
    // End: Admin Menu
    ?>
    
    <h2>Search</h2>
    
    <ul>
    
    <form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    
    <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" /><input type="submit" id="sidebarsubmit" value="Find!" />
    
     </form>
    
     </ul>
    
    <?php endif; ?>

    Thank everyone in advance.

  2. Revolution25
    Member
    Posted 4 years ago #

    Or is there a way to go back to the default setting?

  3. SimonJ
    Member
    Posted 4 years ago #

    From what I can tell, there is a </div> missing at the end of this sidebar to close the opening <div id="sidebar">...

    Possible solution : Just add </div> at the end of the file, after the <?php endif; ?>... Should do the trick...

    Another option : replace the sidebar.php with a fresh one from your theme:

    http://wordpress.org/extend/themes/blass2

    @+

    S.

  4. Revolution25
    Member
    Posted 4 years ago #

    Thank you, Simon.

    That worked. You're a lifesaver.

    For future reference, can you replace just the sidebar.php and not the rest of the theme if you've made changes? That looks like what you were saying.

  5. SimonJ
    Member
    Posted 4 years ago #

    Yes, of course, you can replace any file with a fresh one.

    If your problem is solved, may I suggest to mark this thread as [resolved]?

    @+

    S.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.