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

WordPress custom upload field error

You can use the great wordpress media manager. I’ve prepared a plugin to attach PDF files to noraml posts. You can download it here. The php: <?php /* Plugin Name: PDF Metabox Plugin URI: https://github.com/CybMeta/cyb-pdf-metabox Description: Displays a metabox to attach a PDF file to current post. Author: Juan Padial Version: 1.0.2 Author URI: http://cybmeta.com … 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

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