Articles of csv

Export entries and multiple custom field meta to .csv?

First time poster. I’m trying to export a bunch of custom posts out to a csv file so I can easily import them into a new database. I’ve ran the native export to xml, but it’s not the correct format I need. I need a column based format (ie. name, height, weight, etc.). I have […]

Jetpack – stats_get_csv period parameter

I’d like to create a query to show the top 6 most read posts over the last two days. However, I’d like to only include posts created within the last month to prevent older stories from showing up. I am using Jetpack and stats, so I’ve created this query for Top Posts, but I’m […]

Best practice for adding posts in bulk

I have a set of custom post types and taxonomies I’ve added using the Custom Post Type UI plugin, and need to enter several hundred entries ( >500 ) How can I import this data in bulk? E.g. as a csv?

Creating a Wordpess Plugin that writes data to a csv file. The data doesn't show in the csv file?

I am writing my first WordPress Plugin that should simply write data to a csv file. This is the code, I can’t figure out why the data won’t write to the csv file? add_action(‘admin_menu’, ‘myfirstplugin_admin_actions’); function myfirstplugin_admin_actions() { add_options_page(‘MyFirstPlugin’, ‘MyFirstPlugin’, ‘manage_options’, __FILE__, ‘myfirstplugin_admin’); } function myfirstplugin_admin() { $label = “Entries”; $entries = RGFormsModel::get_form_counts(1); echo “The […]

Using stats_get_csv to return a list of popular posts by views with thumbnails

I recently learned that if you have Stats installed, you can take advantage of stats_get_csv() (Part of the Stats Plugin). <?php if ( function_exists(‘stats_get_csv’) && $top_posts = stats_get_csv(‘postviews’, ‘days=-1&limit=4’) ) : ?> <ol> <?php foreach ( $top_posts as $p ) : ?> <li><a href=”<?php echo $p[‘post_permalink’]; ?>”><?php echo $p[‘post_title’]; ?></a></li> <?php endforeach; ?> […]

Woocommerce – Hide “add to cart” on free products

im using Woocommerce and searching for a way to hide the “Add to cart”-Button on a single-Product page IF the product is for free – I’m making a big CSV-Import and some product-prices are set to zero – i just want to hide the “add to cart” button on these products, so these are not […]

Allow CSV files to be uploaded

I am trying to allow CSV files in a dashboard menu page like this.. <form method=”post” enctype=”multipart/form-data”> <input type=”file” name=”csv_file” id=”csv_file” multiple=”false” accept=”.csv” /> <input type=”submit” value=”Upload” /> </form> require_once( ABSPATH . ‘wp-admin/includes/file.php’ ); require_once( ABSPATH . ‘wp-admin/includes/media.php’ ); $attachment_id = media_handle_upload ( ‘csv_file’, 0, array(), array( ‘test_form’ => false, ‘mimes’ => array( ‘csv’ => […]

Using a database view = evil incarnate?

I’m at a point in doing some WordPress plugin development where from what I can tell I either have to create an entirely new plugin or I can create a database view. The client wants some simple logs of downloads by user and then wants to be able to export these logs to CSV. The […]

Export data as CSV in back end with proper HTTP headers

I wrote a plugin that displays all products in a woocommerce store in admin settings option, now I want to add a link to download the products as CSV file. The problem is, when I click the link I get a permission error saying I don’t have permission to view this page. Here’s my code: […]

How to import CSV into Custom Post Type custom fields?

I have created a Custom Post Type and then used a plugin to create the custom fields for that post type. It will display a type of membership: Name Address Zip Website But I am stuck on how to take the csv file I have, which has 700 entries and import it to create 700 […]