TwentyEleven Sidebar on Single Posts

Some WordPress themes single posts do not include the side bar on single post. For the WordPress 2011 default themes TwentyEleven, it was one of it. Below is the 2 file need to edit to make the side bar appear in TwentyEleven single posts page.

(1) single.php

Add the link get_sidebar above of get_footer as below

<?php get_sidebar(); ?>
<?php get_footer(); ?>

(2) style.css

Add below css style in the css file

.singular #primary {
margin: 0 -26.4% 0 0;
}

#nav-single {
display: none;
}

.singular .entry-header .entry-meta {
position: relative;
}

.singular .hentry {
padding: 0;
}

.singular .entry-header, .singular .entry-content, .singular footer.entry-meta, .singular #comments-title {
width: 100%;
}

.singular #content, .left-sidebar.singular #content {
margin: 0 34% 0 7.6%;
}

.singular article .entry-title {
padding-top: 0;
}

.singular .entry-meta .edit-link a {
right: 0;
top: 0;
left: auto;
}

How to Delete ALL Unapproved WordPress Comments

*Please backup WordPress database before you done all the step as below

1. Go to phpmyadmin in your control panel (based on your hosting plan)

2. Click your Word Press database link

3. Click on the comments table (You can click browse to view all the approved and unapproved comments)

4. Click the mySQL tab. This will open up a query box. Delete the default query and type in:

DELETE FROM wp_comments WHERE comment_approved = 0

5. Click go, this will delete all the unapproved comments

How To Add WP-PageNavi to Twenty Eleven WordPress Theme ?

PageNaviIs a WordPress Plugin that show page in your themes. It was a great plugin for me so far as I have many page on my blog. This post is all about how to add the WP-PageNavi to Twenty Eleven WordPress Theme. Easy and Straight forward.

(1) Open functions.php of twenty eleven

(2) Locate code as below

function twentyeleven_content_nav( $nav_id ) {
        global $wp_query;

        if ( $wp_query->max_num_pages > 1 ) : ?>
                <nav id="<?php echo $nav_id; ?>">
                        <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
                        <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyeleven' ) ); ?></div>
                        <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></div>
                </nav><!-- #nav-above -->

(3)after that line, replace div class=”nav-previous” and div class=”nav-next” with

<?php wp_pagenavi(); ?>

After edit, code will as below

function twentyeleven_content_nav( $nav_id ) {
        global $wp_query;

        if ( $wp_query->max_num_pages > 1 ) : ?>
                <nav id="<?php echo $nav_id; ?>">
                        <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3>
                        <?php wp_pagenavi(); ?>
                </nav><!-- #nav-above -->