Creating categories while importing via CSV

I was able to solve this by checking if the term exists, and then using tax_input in wp_insert_post() // Check if the category exists $category_term = term_exists(trim($category), ‘formula_types’, 0); // Create category if it doesn’t exist if (!$category_term) { $category_term = wp_insert_term(trim($category), ‘formula_types’, array(‘parent’ => 0)); } array_push($formattedCategories, (int)$category_term[‘term_taxonomy_id’]); $post = array( ‘post_title’ => $results[‘drug_name’], … Read more

Issue calling my functions on Plugin activate in WordPress

Please try below code my-plugin.php file <?php /** Plugin Name: My Plugin Plugin URI: http://##### Description: This plugin just for test Author: Chetan Vaghela Version: 1.0.0 Author URI: http://che##la.###/ */ if ( ! defined(‘ABSPATH’) ){ die; } if(!defined(‘MY_PLUGIN_PATH’)) { define( ‘MY_PLUGIN_PATH’, plugin_dir_path(__FILE__) ); } function mbp_activate(){ flush_rewrite_rules(); add_option( ‘my_plugin_activated’, time() ); } require_once MY_PLUGIN_PATH .’inc/mbp-plugin-activate.php’; … Read more

Implementing Scrollable Images

I was implemented it for images, which shows lists of images inside a container like pdf viewer..I just overide the css property of bloc gallery class, and adding an additional class… .image-list{ position: relative !important; padding-bottom: 140% !important; overflow: hidden !important; border: 1px solid #ddd !important; } .blocks-gallery-grid{ position: absolute; left: 0; top: 0; width: … Read more