Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //This is a basic export script. Edit as you need.
- //Save this file as page-foxyshop-export.php in your theme folder
- //Then create a page called "FoxyShop Export" and view it
- header('Content-type: text/csv');
- header('Content-Disposition: attachment; filename="foxyshop-export.csv"');
- $args = array('post_type' => 'foxyshop_product', 'post_status' => 'publish', 'posts_per_page' => -1);
- $the_query = new WP_Query( $args );
- while ( $the_query->have_posts() ) :
- $the_query->the_post();
- $post_id = $the_query->post->ID;
- $product = foxyshop_setup_product($post_id);
- echo '"' . str_replace('"', '""', get_the_title()) . '"'; //title
- echo ',"' . str_replace('"', '""', $product['code']) . '"'; //code
- echo ',"' . str_replace('"', '""', $product['description']) . '"'; //description
- echo ',"' . str_replace('"', '""', $product['price']) . '"'; //price
- echo "\n";
- endwhile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement