How can I upload a csv file into WordPress?

I’m not really clear on what you want to do, but there are several CSV import plugins. http://wordpress.org/extend/plugins/search.php?q=csv But if you need to link the imported data to specific, existing posts, then it is more of an MySQL question and not purely WordPress.

Use WP_Filesystem to list files in directory

Unfortunately the documentation about the Filesystem API is very basic. What you are looking for is the dirlist method/function of the WP_Filesystem_$method class(es). The only documentation about it is the docblock out of the WP_Filesystem_Base class: /** * Get details for files in a directory or a specific file. * * @since 2.5.0 * * … Read more

View content from uploaded file in editor

Okay.. I’m really losing it here. I’m just gonna extract it all so it might be more clear. In my functions.php: function jj_readcsv($filename, $header=false) { $handle = fopen($filename, “r”); echo ‘<table style=”width:100%;”>’; //display header row if true if ($header) { $csvcontents = fgetcsv($handle); echo ‘<tr>’; foreach ($csvcontents as $headercolumn) { echo “<th>$headercolumn</th>”; } echo ‘</tr>’; … Read more

Setting the uploads directory

You can use the ‘upload_dir’ filter add_filter(‘upload_dir’, ‘set_upload_folder’, 999); function set_upload_folder( $upload_data ) { // absolute dir path, must be writable by wordpress $upload_data[‘basedir’] = trailingslashit(ABSPATH). ‘/files’; $upload_data[‘baseurl’] = ‘http://subdomain.wptest.com/files’; $subdir = $upload_data[‘subdir’]; $upload_data[‘path’] = $upload_data[‘basedir’] . $subdir; $upload_data[‘url’] = $upload_data[‘baseurl’] . $subdir; return wp_parse_args($upload_data, $upload_data); } This code will works no matter if year/month … Read more

How to change the image size in new Media Uploader (ie use medium vs thumbnail)

Supposing that I’m interpreting your Question correctly… The thumbnails displayed in the new Media Uploader are already the medium sized ones, being constrained on the fly. So, it’s a matter of applying some CSS styling to increase their size. Maybe other style adjustments are necessary, this is just a proof of concept. add_action( ‘admin_head-post-new.php’, ‘style_thumbnails_wpse_81677’ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)