Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   2 columns for posts on blog home page? (http://forum.bytesforall.com/showthread.php?t=1288)

redbiker Apr 16, 2009 08:44 AM

2 columns for posts on blog home page?
 
I'm new to Wordpress/php so please be gentle with me.

How can I edit the index.php file (assuming that's what I need to do) so that when the homepage is displayed posts are shown in 2 even columns rather than the standard single column?

Flynn Apr 16, 2009 06:10 PM

Read the bottom of this post first on how to apply this to only the homepage

In index.php replace

PHP Code:

    <?php // The LOOP. Do this for all posts:
    
while (have_posts()) : the_post(); $postcount++; ?>

(or similar, I am already in 3.3.3)

with

PHP Code:

    <table cellpadding="0" cellspacing="0" border="0">
    <?php $column 1?>
    <?php // The LOOP. Do this for all posts:
    
while (have_posts()) : the_post(); $postcount++; ?> 

        <?php if ($column == 1) echo "<tr>"?>

        <td class="column<?php echo $col;?>" style="vertical-align: top">

and still in index.php replace

PHP Code:

    <?php // END of the LOOP
    
endwhile; ?>

with

PHP Code:

        </td>
        
        <?php if ($column == 2) echo "</tr>"; (($column==1) ? $column=$column=1); ?>
        
    <?php // END of the LOOP
    
endwhile; ?> 
</table>

And at Theme Options -> Posts or Excerpts
choose "Only Excerpts" everywhere


Or, to limit this to the homepage make a copy of index.php as home.php, apply the above edits in home.php instead of index.php and upload home.php to the theme's directory /wp-content/themes/atahualpa332/, and set Theme Options -> Posts or Excerpts -> Posts or excerpts on HOME page? to "Only Excerpts"

redbiker Apr 17, 2009 02:59 AM

Thanks Flynn. I found a slightly different way of doing it on my own in the end.

I've added a home.php file to the theme then found a neat way of doing a two column layout here...

http://perishablepress.com/press/200...ss-post-order/

deanshultz Oct 26, 2009 06:39 PM

Atahualpa is quite a theme. Even more impressive is the forum.

I've spent hours looking for custom themes, magazine style stuff. Most solutions either don't offer enough features or don't offer enough customization. The trade-off was always unsatisfying.

Fortunately, the forums are very thorough, best I've seen. And, so, I found this post which answered my question exactly.

Can't thank you guys enough. Oh, wait, I can. I will click 'Donate'.

marcelo Jan 7, 2010 06:48 PM

Hi Flynn,

Forgive me I'm new and don't know about coding. Could you show me how to make it into 3 columns instead for 2? Is it even possible? I'm using Atahualpa 3.4.4 already.

Thank you so much!

juggledad Jan 8, 2010 07:32 AM

You can easily set the theme to use 1, 2, 3, 4 or 5 columns: two sidebars on eithor side and the center column. To set the sidebars to use, go to ATO->Style & configure SIDEBARS and take a look at the optins.

marcelo Jan 8, 2010 10:30 AM

Thanks for your help juggledad. But what I want to do is for the center column to show all the posts in 3 columns instead of the 1 by default. It's the same intention as the original poster, who wanted 2 columns. The code that Flynn provided works perfect when i tried it with my blog. However, I want to know how to modify that code so that instead of 2 columns of posts, it shows 3.

myinfosecjob Jan 16, 2010 06:52 AM

Hello ladies and gents.
Using the code provided by Flynn, I managed to have the center page split into 2, thanks for that!

Now, to make things a bit more complicated, how can I post certain categories only to the left side, and another different category to the right?

As some of the readers, my awareness about PHP is almost nil.

Thank you!

Adriano

Sachein Jan 21, 2010 01:08 PM

Hi Flynn, thank you very much for this table. I just have one problem, how do I remove gaps. Below is an image of what I am talking about.

http://www.tamileelamonline.com/wp-c...loads/gaps.png

Sachein Jan 29, 2010 11:05 AM

How do you make three columns?

marcelo Jan 29, 2010 05:06 PM

Please, I've been trying to figure the same thing out, but no luck. Flynn, please help us out when you get a chance. I know you are busy with the ThemeFrame, which is coming out awesome with Beta 5.
Thank you in advance!

Sachein Feb 7, 2010 06:01 AM

Hi Marcelo,

Here is the link: http://wordpress.org/support/topic/358182?replies=7

marcelo Feb 8, 2010 10:25 AM

Hi Sachein,

Thank for so much for finding that post. I will try it and see how it works.
Thanks again!

bobbypeke Feb 16, 2010 10:37 PM

Hi there!

I've tried the code that Flynn provided and although it does split the center into two column, I was wondering if there was a way to divide only the excerpt posts into 2 columns. For example post 1 to post 3 are full pages, while the rest of the posts are excerpts divided into two columns. My coding skills are pretty limited but I have tried changing the index.php file with no results.

marcelo Feb 19, 2010 11:08 AM

Quote:

Originally Posted by Sachein (Post 25011)

Thank you, Sachein! I followed the article and it worked perfect!

PixelGraphixDesign Feb 28, 2010 03:21 PM

How would you do this for a static site (not a blog) to format particular pages? What if I want three columns on one page, two on another, one on another? Is there a way?

juggledad Mar 1, 2010 04:30 AM

use HTML in the page to build a table with the number of columns you want then add your data to a cell in each column

vil2 Mar 14, 2010 05:41 PM

That's a nice idea.

Do you think it would be possible to display the first post as usual, then below this post, display a table with 2 columns with their own styles, from post 2 to post XX...?

chiara7 Mar 21, 2010 05:22 AM

These articles would be helpful to create multiple loops and columns:
http://perishablepress.com/press/200...ith-wordpress/
http://perishablepress.com/press/200...ss-post-order/

Tim F Mar 31, 2010 03:22 AM

Hey all,

Is it possible to use this code but only apply it to my archive pages?

**edit: found what I wanted with the search function :D

vil2 Mar 31, 2010 04:45 PM

Hi again,

I managed to display the home page with two columns, thanks to this guide and to some modifications.
I have the same problem than Sachein, ie some of my cells have a gap I can't remove (please see : http://www.lebardessciences.com )
I tried the method he gave but with no success. What am I missing? Here is the code I use to display the columns:

HTML Code:

<table class="table_central">
    <?php $column = 1; ?>
    <?php // The LOOP. Do this for all posts:
    while (have_posts()) : the_post(); $postcount++; ?>


        <?php if ($column == 1) echo "<tr>"; ?>

        <td class="column<?php echo $col;?>" style="vertical-align: top">

                        <div class="post" id="post-<?php the_ID(); ?>">

                               

                                <div class="descr"></div><?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>

<?php bfa_post_headline('<div class="post-headline">','</div>'); ?><?php bfa_post_byline('<div class="post-byline">','</div>'); ?>

        <div class="entry">

                      <?php the_content('Read the rest of this entry &raquo;'); ?>

                                </div>

                        </div>

        </td>

        <?php if ($column == 2) echo "</tr>"; (($column==1) ? $column=2 : $column=1); ?>

    <?php // END of the LOOP
    endwhile; ?>



</table>

Thanks a lot

juggledad Apr 1, 2010 03:34 AM

Your problem is not with the code, it's the amount of copy in the cell varies so the cells are of different size. If you notice, the top of each cell lines up, it's the bottom that gives you the issue

thid idn't s perfect solution but it msy be enough.
set the container color to white (#ffffff) then change your CSS Insert for
HTML Code:

.table_central {
border:0px;
margin:0 0 0 0;
padding:0 0 0 0;
cellpadding:0px;
cellspacing:0px;
overflow:hidden
}

to
HTML Code:

.table_central td.column {
border-right:solid 5px #cc0000;
}
div.post {
border-top:solid 5px #cc0000;
}
.table_central {
border:solid 5px #cc0000;
margin:0 0 0 0;
padding:0 0 0 0;
cellpadding:0px;
cellspacing:0px;
overflow:hidden
}


vil2 Apr 1, 2010 05:09 AM

Thanks a lot. I managed to remove those gaps. How is it that even with cellpadding and cellspacing set to 0, I cannot remove the small space between the cells? My idea was to remove the vertical space between two cells and display the side borders of the cells to have a vertical separation betwwen two cells.

jg75cl Apr 1, 2010 09:25 AM

I have the columns working perfectly. Thanks for all.

Now, there are an option to have the last post in one column, and the rest in two? So always the last will be prominent. Thanks

prokopino May 9, 2010 07:16 AM

can we made a frontpage like this?
1
2 - 3
4 - 5
6 - 7

i mean, the latest post in one row and the others in two rows.

thanks for your time


All times are GMT -6. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.