Archive for May, 2006

10
May

b2 to WordPress migration script

Just wonderful !!! 

Aral Balkan "decided to write my own script to carry out the migration as the latest WordPress release doesn’t contain one and the only other alternative, apparently, would have been to go through a ridiculous series of upgrades".

Download the b2 to WP migration script (b2towp.zip; 19kb)

1. Use PHPMyAdmin to export your b2 database into an SQL file.

2. Install WP 2.0.2

3. On the machine you installed WP, use PHPMyAdmin to create a database for your b2 database and import it from the SQL file you created in Step 1.

4. Open the b2towp.php file in an editor and enter the database connection info for both the b2 and WP databases at the head of the file.

5. Run the b2towp.php script

Can't wait to test it.

01
May

Multiple loops + get_posts : how to avoid duplication

$posts = get_posts('numberposts=10&offset=1'); foreach ($posts as $post): setup_postdata($post);

The code above resets the counter, and re-runs the loop. The offset can be set to whatever you want, the default is 0.

To avoid duplication, you need to test against the first post in the second loop  :  

while($top_query->have_posts()) : $top_query->the_post(); $first_post = $post->ID;

Then the new second loop:

query_posts('showposts=6'); ?> <?php while(have_posts()) : the_post(); if(!($first_post == $post->ID)) :

~ template tags 'n stuff go here ~

endif; endwhile;

query_posts offset

see also here here

The solution also works if you want to get the posts displayed in columns. Use a query for each column and display the result in the appropriate div.




 

May 2006
M T W T F S S
« Apr   Sep »
1234567
891011121314
15161718192021
22232425262728
293031  

Recent Comments