Custom Plugin For Converting CSV To MySQL

To start with, you need to fix the define of CSV_PATH: define(‘CSV_PATH’,dirname(__FILE__)); as without that, $handle will be false – no file opened or data read. …then before you run it take another look becaue $col4 and $col5 are not set anywhere either…

Show post in slider

I used this to show images on slider .Try this <div class=”col-md-12″> <div class=”carousel carousel-showmanymoveone slide” id=”carousel123″> <div class=”carousel-inner”> <div class=”item active”> <div class=”col-xs-12 col-sm-6 col-md-3″> <img src=”https://wordpress.stackexchange.com/questions/217614/<?php echo plugin_dir_url( __FILE__ ) .”img/download-1.jpg’; ?>”></div> </div> <div class=”item”> <div class=”col-xs-12 col-sm-6 col-md-3″> <img src=”https://wordpress.stackexchange.com/questions/217614/<?php echo plugin_dir_url( __FILE__ ) .”img/download-1.jpg’; ?>”></div> </div> <div class=”item”> <div class=”col-xs-12 col-sm-6 … Read more

How to add custom post meta to default blog post?

You can use the action hook save_post_{post_type}, so for the post type ‘post’ (blog posts) it is: save_post_post. For more info see the codex. add_action( ‘save_post_post’, ‘sw150216_save_reading_time’, 10, 3); function sw150216_save_reading_time( $post_id, $post, $update ) { $reading_time = estimated_reading_time( $post ); if ( $update ) { update_post_meta ( $post_id, ‘reading_time’, $reading_time ); } else { … Read more

Admin Options page. Save as Array

You only need to register one setting and then just modify your form inputs to save the values into an array. Here’s an example of registering the setting: register_setting( ‘mytheme_settings’, ‘mytheme_settings’, ‘admin_options_sanitize’ ); $mytheme_settings = get_option( ‘mytheme_settings’ ); and the field markup: <textarea name=”mytheme_settingsAdmin Options page. Save as Array”> <?php echo esc_textarea( $mytheme_settings[‘title’] ); ?> … Read more

Displaying theme options in css

Although @Jevuska did solve my issue, I have found a much easier solution to adding dynamic CSS from my theme options page. Here we go! Add this to functions.php add_action(‘wp_head’, ‘my_custom_css’); function my_custom_css(){ require_once( get_template_directory() . ‘/css/theme-styles.php’ ); } Now you can treat theme-styles.php as a normal CSS stylesheet <style type=”text/css”> a { color: <?php … Read more

How to review WordPress website php version compatibility?

By default WP is very reluctant to show or display any errors. That’s inline with its strategy of “dumbing down” things of sorts. The configuration I use to monitor for errors is along the lines of this in wp-config.php: define( ‘WP_DEBUG’, true ); define( ‘WP_DEBUG_DISPLAY’, false ); @ini_set( ‘display_errors’,’Off’ ); @ini_set( ‘log_errors’,’On’ ); @ini_set( ‘error_log’,’/home/user/logs/php_site_name.log’ … Read more

Get Custom URL For Custom Taxonomy

Sorry to come to the party late. Here is my solution <?php //Retrieve the terms in productcategory taxonomy with posts (not empty) $terms = get_terms( array ( ‘taxonomy’ => ‘productcategory’, ‘hide_empty’ => false, ‘parent’ => 0, ‘orderby’ => ‘description’, ‘order’ => ‘ASC’ )); //loop through each term to get its attributes foreach ($terms as $term) … Read more

Is there a way to get 3+ dimensional array from a single MySql command

The direct answer to the question “Is there a way to get 3+ dimensional array from a single MySql command” would be yes, sort of – WordPress routinely stores and retrieves multidimensional data from MySQL rows by serialize()ing and unserialize()ing structured data to/from a string format, so it’s certainly possible using WordPress’s database interaction mechanisms. … Read more