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 up the child theme so as to enable right-to-left WordPress?

You also need to include the RTL.css file which is in the theme too: add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘rtl-style’, get_template_directory_uri() . ‘/rtl.css’ ); } To use the rtl.css from your theme directory change the code to: add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, … Read more

Image Crop/Resize Function/Code Sinppet/Plugin to adjust/crop images during upload

-= 1 =- This is untested and might not work with your theme if it’s using a custom function to upload the actual images, but I would add the size you want using add_image_size( ‘profile_photo’, $width, $height, array( ‘center’, ‘middle’ ) ); to your functions.php file. Then you can retrieve the image using wp_get_attachment_image_src() passing … Read more

Navigation link to specific user page

While you could possibly add a filter to walker_nav_menu_start_el and have your callback function alter/recreate the menu item according to your needs, I would say the best and easiest solution is to implement you own menu walker, and supply that to wp_nav_menu. This should help get you started: class WPSE_90204_Walker extends Walker_Nav_Menu { function start_el( … Read more

Problem in custom meta boxes

Okay got the issue, here is the complete code that is saving data. The issues are explained at the bottom: /** * Adds a box to the main column on the Post and Page edit screens. */ function nss_mood_add_meta_box() { //$id, $title, $callback, $post_type, $context,$priority, $callback_args add_meta_box(‘nss_mood_id’,’Set your mood’,’nss_mood_cb’,’post’); } add_action(‘add_meta_boxes’,’nss_mood_add_meta_box’); // Dispalying form and … Read more

Query post types with multiple keys

meta_query has a relation parameter just like tax_query so: $documents = array( ‘post_type’ => ‘documents’, ‘meta_query’ => array( ‘relation’ => ‘AND’, array( ‘key’ => ‘document-type’, ‘value’ => ‘manual’, ), array( ‘key’ => ‘document-status’, ‘value’ => ‘current’, ) ) ); query_posts( $documents ); get_template_part( ‘loop’, ‘documents’ ); wp_reset_query();