Export WordPress Posts to Excel

Create a file in your theme ‘download.php’. And the save the file with the below content.

<?php
/* Template Name: Download */
wp_head(); ?>
<table id="download">
<tr>
<th>Title</th>
<th>Address</th>
<th>Area</th>
<th>Postal Code</th>
<th>City</th>
<th>Manager</th>
<th>Phone No</th>
<th>E-Mail</th>
<th>Website</th>
<th>Category</th>
</tr>
<?php $downloads = new WP_Query('showposts=-1');
while ($downloads->have_posts()): $downloads->the_post();
global $post; ?>
<tr>
<td><?php the_title();?></td>
<td><?php the_permalink();?></td>
<td><?php echo get_post_meta($post->ID,'custom_field_name',true);?></td>
<td><?php $poc = get_the_terms( $post->ID, 'custom_taxonomy_name', '', ', ', '' ); $list = ''; if ($poc) { foreach ($poc as $data) $list .= $data->name.', '; echo $list; } ?></td>
<td><?php $cats = get_the_category(', '); $list = ''; if ($cats) { foreach ($cats as $data) $list .= $data->cat_name.', '; echo $list; } ?></td>
</tr>
<?php
endwhile;
wp_reset_query(); ?>
</table>

And create a new page in your WordPress admin dashboard , with the name ‘Download’ and select the page template to ‘Download’, and keep the page has private and just view the page.

You will get the all your posts.

Just copy it and save it in XLS.

Advertisement
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.