Easy Coding for WordPress: Posts in 3 Columns

Sometimes it is the simple things that are hard to find.

A basic structure to arrange posts into three columns:

<div id="column-wrap">
<?php $count = 0;

while(have_posts()) : the_post(); ?>

<div class="box<?php if( $count%3 == 0 ) { echo '-1'; }; $count++; ?>">

<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<!--and other output of the loop -->


<?php endwhile; ?>
</div><!--end column-wrap-->

The minimal styles needed for the three columns:

.box-1 { float:left; clear:left; width: 30%; margin-left: 0; }
.box { float:left; width: 30%; margin-left: 3%; }

  1. <div id=”column-wrap”>
  2. <?php
  3. $count = 0;
  4. while(have_posts()) : the_post()
  5. ?>
  6. <div class=”box<?php if( $count%3 == 0 ) { echo ‘-1’; }; $count++; ?>“>
  7. <a href=”<?php the_permalink(); ?>“>
  8. <h4><?php the_title(); ?></h4></a>
  9. <!–and other output of the loop –>
  10. </div>
  11. <?php endwhile; ?>
  12. </div><!–end column-wrap–>
  13. —————-
  15. .box-1 { float:left; clear:left; width: 30%; margin-left: 0; }
  16. .box { float:left; width: 30%; margin-left: 3%; }

wp3.1 – new feature – the admin bar

wordpress 3.1 has brought a few new features which might puzzle some users.

one very prominent feature is the new admin bar that by default appears on top of your site when you are logged in as administrator. although the ordinary viewer won’t be able to see this, for some users this bar is a little disturbing.

there is a quick fix: on the admin bar, click the ‘admin’ dropdown, then click ‘edit my profile’ – this brings you to the profile page, where you can change the setting:

Show Admin Bar
[ ] when viewing site
[x] in dashboard

now it will show the admin bar in the background/dashboard where it might come in useful.

there is also a change in the default settings of the ‘screen options’ – if you can’t find your familiar fields to enter/edit things, check the ‘screen options’ tab in the top right area of the corresponding page in the dashboard.

Adsense Ad at the More Tag Position

Surprise your readers with a google ad after clicking the ‘read more’ link – a strategic position to catch the attention of the viewer and increase your revenue.

Advertising does not get the same attention all over your page, as this report shows, some areas are ‘hotter’ than others, and the top of your content is one of the ‘hottest’.

Many of you insert the ‘more-tag’ after a short introductionary part of your content when writing your articles – usually to keep the design of the home page clean and easy to navigate.

When  the reader clicks on the ‘continue reading’ button, this already proves that the article has so far captured his attention – and the reader is more likely to follow any targeted advertising links, particular if these are seamlessly integrated into the main post content.

Continue reading “Adsense Ad at the More Tag Position”

Custom ‘Read More’ text per Post for Twenty Ten

A sophisticated way to get a custom written ‘read more’ text added to your posts in the theme Twenty Ten (or its child themes).

The code builds on this article I posted earlier.

It uses the custom field with the key ‘cont_read’ to hold the custom text.

Add this code to functions.php of the theme:

/* Twenty Ten custom 'continue reading'
/ custom field ($key = 'cont_read' ) dependant 'continue reading' text
/ alchymyth 2010
class Transformation_Text_Wrangler {
function reading_more($translation, $text, $domain) {

global $post;
 $cont_read = get_post_meta( $post->ID, 'cont_read', true );
 if( $cont_read ) :
 $cont_read = htmlentities($cont_read, ENT_QUOTES);
 $translations = &get_translations_for_domain( $domain );
 if ( $text == 'Continue reading <span>&rarr;</span>' ) {
 return $translations->translate( $cont_read . ' <span>&raquo;</span>' );
 return $translation; // custom field value
 else :
 return $translation; // standard text
add_filter('gettext', array('Transformation_Text_Wrangler', 'reading_more'), 10, 4);