|
#1
Apr 16, 2009, 09:44 AM
|
|
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
Apr 16, 2009, 07:10 PM
|
|
|
|
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=2 : $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"
|
#4
Oct 26, 2009, 07: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'.
|
#5
Jan 7, 2010, 07: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!
|
#6
Jan 8, 2010, 08:32 AM
|
|
|
|
23,765 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
Jan 8, 2010, 11: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.
|
#8
Jan 16, 2010, 07: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
|
#9
Jan 21, 2010, 02: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.
|
#10
Jan 29, 2010, 12:05 PM
|
|
How do you make three columns?
|
#11
Jan 29, 2010, 06: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!
|
#12
Feb 7, 2010, 07:01 AM
|
|
|
#13
Feb 8, 2010, 11:25 AM
|
|
Hi Sachein,
Thank for so much for finding that post. I will try it and see how it works.
Thanks again!
|
#14
Feb 16, 2010, 11: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.
|
#15
Feb 19, 2010, 12:08 PM
|
|
Quote:
Originally Posted by Sachein
|
Thank you, Sachein! I followed the article and it worked perfect!
|
#16
Feb 28, 2010, 04: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?
|
#17
Mar 1, 2010, 05:30 AM
|
|
|
|
23,765 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
Mar 14, 2010, 06: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...?
|
#19
Mar 21, 2010, 06:22 AM
|
|
|
|
18 posts · Sep 2009
Budapest - Hungary
|
|
|
#20
Mar 31, 2010, 04: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
Last edited by Tim F; Mar 31, 2010 at 06:01 AM.
|
#21
Mar 31, 2010, 05: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 »'); ?>
</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
Apr 1, 2010, 04:34 AM
|
|
|
|
23,765 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
Apr 1, 2010, 06: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.
|
#24
Apr 1, 2010, 10: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
|
#25
May 9, 2010, 08: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
|
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 07:48 AM |
[SOLVED] Blog Page causes Home Page Tab to light up as well
|
WebWeaver |
Header configuration & styling |
1 |
Jun 30, 2009 07:45 PM |
Disply posts in all three columns-- plus, ideally, a widget or two, too?
|
petevannuys |
Sidebars & Widgets |
2 |
Jun 11, 2009 07:51 PM |
recent posts in the right sidebar, but not on the home page
|
ind |
Sidebars & Widgets |
1 |
May 6, 2009 04:49 AM |
Limit the number of Posts on Home Page
|
coaxkid |
Post-Kicker, -Byline & -Footer |
4 |
Apr 12, 2009 07:01 PM |
|