Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

2 columns for posts on blog home page?


  #1  
Old Apr 16, 2009, 08:44 AM
redbiker
 
2 posts · Apr 2009
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?
  #2  
Old Apr 16, 2009, 06:10 PM
Flynn's Avatar
Flynn
 
3,768 posts · Oct 2008
Munich, Germany
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"
  #3  
Old Apr 17, 2009, 02:59 AM
redbiker
 
2 posts · Apr 2009
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/
  #4  
Old Oct 26, 2009, 06:39 PM
deanshultz
 
2 posts · Oct 2009
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'.
  #5  
Old Jan 7, 2010, 06:48 PM
marcelo
 
12 posts · Dec 2009
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!
  #6  
Old Jan 8, 2010, 07:32 AM
juggledad's Avatar
juggledad
 
23,655 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #7  
Old Jan 8, 2010, 10:30 AM
marcelo
 
12 posts · Dec 2009
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.
  #8  
Old Jan 16, 2010, 06:52 AM
myinfosecjob
 
12 posts · Jan 2010
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
  #9  
Old Jan 21, 2010, 01:08 PM
Sachein
 
3 posts · Jan 2010
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.

  #10  
Old Jan 29, 2010, 11:05 AM
Sachein
 
3 posts · Jan 2010
How do you make three columns?
  #11  
Old Jan 29, 2010, 05:06 PM
marcelo
 
12 posts · Dec 2009
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!
  #12  
Old Feb 7, 2010, 06:01 AM
Sachein
 
3 posts · Jan 2010
Hi Marcelo,

Here is the link: http://wordpress.org/support/topic/358182?replies=7
  #13  
Old Feb 8, 2010, 10:25 AM
marcelo
 
12 posts · Dec 2009
Hi Sachein,

Thank for so much for finding that post. I will try it and see how it works.
Thanks again!
  #14  
Old Feb 16, 2010, 10:37 PM
bobbypeke
 
1 posts · Jul 2009
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.
  #15  
Old Feb 19, 2010, 11:08 AM
marcelo
 
12 posts · Dec 2009
Quote:
Originally Posted by Sachein
Thank you, Sachein! I followed the article and it worked perfect!
  #16  
Old Feb 28, 2010, 03:21 PM
PixelGraphixDesign
 
23 posts · Feb 2010
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?
  #17  
Old Mar 1, 2010, 04:30 AM
juggledad's Avatar
juggledad
 
23,655 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #18  
Old Mar 14, 2010, 05:41 PM
vil2
 
13 posts · Jan 2010
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...?
  #19  
Old Mar 21, 2010, 05:22 AM
chiara7's Avatar
chiara7
 
18 posts · Sep 2009
Budapest - Hungary
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/
  #20  
Old Mar 31, 2010, 03:22 AM
Tim F
 
66 posts · Jul 2009
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

Last edited by Tim F; Mar 31, 2010 at 05:01 AM.
  #21  
Old Mar 31, 2010, 04:45 PM
vil2
 
13 posts · Jan 2010
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
  #22  
Old Apr 1, 2010, 03:34 AM
juggledad's Avatar
juggledad
 
23,655 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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
}
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #23  
Old Apr 1, 2010, 05:09 AM
vil2
 
13 posts · Jan 2010
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.
  #24  
Old Apr 1, 2010, 09:25 AM
jg75cl
 
1 posts · Apr 2010
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
  #25  
Old May 9, 2010, 07:16 AM
prokopino
 
9 posts · Feb 2010
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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a Home Page with Posts in it? wdycus Post-Kicker, -Byline & -Footer 5 Aug 31, 2010 06:48 AM
[SOLVED] Blog Page causes Home Page Tab to light up as well WebWeaver Header configuration & styling 1 Jun 30, 2009 06:45 PM
Disply posts in all three columns-- plus, ideally, a widget or two, too? petevannuys Sidebars & Widgets 2 Jun 11, 2009 06:51 PM
recent posts in the right sidebar, but not on the home page ind Sidebars & Widgets 1 May 6, 2009 03:49 AM
Limit the number of Posts on Home Page coaxkid Post-Kicker, -Byline & -Footer 4 Apr 12, 2009 06:01 PM


All times are GMT -6. The time now is 12:45 AM.


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