WordPress.org

Ready to get started?Download WordPress

Forums

How-to: Two post columns Twenty Eleven (9 posts)

  1. Digital Raindrops
    Member
    Posted 2 years ago #

    I have recreated a post I wrote for twenty ten for the twenty eleven theme, this is the display of two columns for the index.php file, with the option to show thumbnails.

    Due to the fluid nature of twenty eleven, with the small screen and mobile options, the code we used in twenty ten is not suitable for the twenty eleven theme.

    There is a child theme with the code and files, which can be downloaded, recent changes means that no registration is required.

    Read the post here:

    In the download file:

    • functions.php - function to load custom stylesheet and change the excerpt length.
    • index.php - with changes for two columns
    • content-index.php - loop file with changable arguments, can show image and excerpt as default.
    • custom-styles.css - stylesheet created for dark theme option.
    • style.css - child theme stylesheet.
    • screenshot.jpg

    Regards

    David

  2. Tara
    Member
    Posted 2 years ago #

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    @t-p
    thanks for quoting me ;-)

    however, David isn't actually asking anything - he is just presenting a child theme of Twenty Eleven which does show two post columns perfectly.

    that is the reason why this topic is marked as 'not a support question'

  4. bittadesign
    Member
    Posted 2 years ago #

    @Digital Raindrops I have been trying to design a blog with two content columns side by side (sort of like this http://3191milesapart.com/) so I was very excited to see your child theme for twentyeleven. However, I have been unable to get two columns to display. all the content is currently just displaying in a single column.

    I am very new to wordpress and don't have a lot of technical knowledge. But I created a child theme and uploaded the files from your site and activated the child theme. i'm just not sure where I went wrong. Any feedback or suggestions would be greatly appreciated.

    the blog: http://www.thealbrecht.com

    Thanks

  5. waqas.ahmed
    Member
    Posted 1 year ago #

    I really like your tutorial of splitting the content area into two. I exactly need this tutorial. I have setup this successfully. I need some modification. I want fix the height of each post and border of the each post and also image should stretch on the front page. So i add in the css “height: 500px;” under the .column-left or right section. Please check my current main page view here: https://docs.google.com/file/d/0Bwirjuyb_eiabDRldTNoLUF5UlE/edit?pli=1

    I want, each post select specific textarea from each post and then read more shows. Please tell me how can i do this. Thanks alot

  6. lee718
    Member
    Posted 1 year ago #

    Firstly, thanks for this great resource. I have a question regarding pulling in custom post types that I've created into a page template. And actually I've tried both content-about.php and about-page.php. Here's what I've done:

    In your index.php I have changed this piece:
    <?php get_template_part( 'content', 'about' ); ?>

    and in content-about.php in the post types part I have changed this piece:
    <?php if ( 'post' == get_post_type('myposttype') ) : ?>
    <div class="entry-meta">
    <?php twentyeleven_posted_on(); ?>
    </div><!-- .entry-meta -->
    <?php endif; ?>

    'myposttype' is registered in the functions.php file correctly. I've had it working on 1 column but now I need the 2-col.

    My post type is not displaying at all but regular post types are displaying nicely in the 2-col format.

    I would really appreciate your help. Thanks.

  7. Digital Raindrops
    Member
    Posted 1 year ago #

    Hi Lee,
    You need to use a custom loop to get the custom post types, so they are filtered before the loop, as a rule index.php only shows type==post

    Have a look at creating a page of posts template for your custom post type.

    Then call your custom loop in the page template, create an empty page and apply the template.

    HTH

    David

  8. lee718
    Member
    Posted 1 year ago #

    This is a custom loop right?

    <?php while ( have_posts() ) : the_post();
    $args = array(
    'post_type' => 'books',
    'posts_per_page' => 4
    );
    $loop = new WP_Query( $args );
    
    while ( $loop->have_posts() ) : $loop->the_post();
     the_title('<h2 class="books">','</h2>');
    echo '<div class="one">';
    
    the_post_thumbnail('thumbnail', array('class' => 'alignleft'));
    echo the_excerpt();
    
    echo '</div>';
    endwhile; // end of the loop. ?>
  9. lee718
    Member
    Posted 1 year ago #

    Thanks David for taking a look. I basically just created a page template…page-about.php and added it to your theme folder, and pointed my posts to it in the dashboard settings:
    http://pastebin.com/kYXibm9L

    The only other change I made to the folder was to register the post type, so your functions file ended up looking like this:
    http://pastebin.com/9yCs7QxP

    I have been tinkering with this and just can’t for the life of me figure it out. Really appreciate and help.
    -Lee

Topic Closed

This topic has been closed to new replies.

About this Topic