Skip to main content

How to create wp_editor/Custom editor in wordpress/Woo-commerce?

Create wp_editor/Custom editor in wordpress/Woo-commerce.


add_action("admin_init", "certifications");
add_action('save_post', 'save_subdescription');
function certifications(){
add_meta_box("sub_description", "Certifications", "meta_function", "product");
}
function meta_function(){
global $post;
$custom = get_post_custom($post->ID);
$sub_description = $custom["sub_description"][0];
wp_editor( $sub_description, 'certifications', $settings =
array('textarea_name'=>'sub_description','dfw'=>true) );
}
function save_subdescription(){
global $post;
update_post_meta($post->ID, "sub_description", $_POST["sub_description"]);
}



function show_certification_content(){

echo get_post_meta( get_the_ID(), 'sub_description', true );



//echo get_the_content();
}
add_action('woocommerce_before_single_product_summary','show_certification_content');

Comments

Popular posts from this blog

How to check date format in PHP?

Check date format in PHP function isCorrectDateFromat($date){     if(!empty($date)){         $dateString = $date; // Replace this with your date string         $format = "Y-m-d"; // Replace this with your expected date format         $dateTime = DateTime::createFromFormat($format, $dateString);         if ($dateTime === false) { /*             echo "The date is not in the correct format."; */         } else {             $errors = DateTime::getLastErrors();             if (empty($errors)) { /*                 echo "The date is in the correct format."; */                 return true;             } else { /*                 echo "...