Posts

Showing posts from October, 2015

How to add a custom or new order status in woocommerce wordpress

For add a custom or new order status in woocommerce store. just copy and paste below code into your theme's functions.php or in your custom plugins file. For example i am add a shipping order status for order . // register post status wc-shipping add_action('init','register_shipping_post_status'); function register_shipping_post_status(){         register_post_status( 'wc-shipping', array(             'label'                     => 'Shipping',             'public'                    => true,             'exclude_from_search'       => false,             'show_in_admin_all_list'    => true,             'show_in_admin_status_list' => true,             'label_count'               => _n_noop( 'Shipping <span class="count">(%s)</span>', 'Shipping <span class="count">(%s)</span>' )         ) );     } Now for add a shipping s

How to allow html tags in the_excerpt post function in wordpress

Just copy and paste below code into your theme's functions.php file or in your custom plugin file. and change according to your need. function rj_wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) {     $text = get_the_content('');     $text = strip_shortcodes( $text );     $text = apply_filters('the_content', $text);     $text = str_replace(']]>', ']]&gt;', $text);          $allowed_tags = '<p>,<a>'; // write your tags here for allow them in excerpt with comma seprated     $text = strip_tags($text, $allowed_tags);          $excerpt_word_count = 55; // change length of excerpt according to your need     $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);          $excerpt_end = '[...]';     $excerpt_more = apply_filters('excerpt_more', ' ' . $excerpt_end);          $words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPL