How do_action funtion works with path parameter?

The first argument of do_action is the $tag, a string. As far as the API is concerned, there’s no special meaning to the contents of the $tag, it’s just a unique name that’s matched as a whole to hooked actions of the same name. The structure and naming convention of tags is up to the … Read more

With W3 Total Cache when I publish a post it does not appear in the homepage. Only if i purge all cache [closed]

You are most likely using browser caching ? Therefore new visitors would see the newly published post just fine, but because you’ve previously visited the page its cached and therefore your browser cache hasnt expired. Generally its good practice to clear all caches upon publishing posts/pages and/or activating or deactivating a plugin. You can also … Read more

Custom posts don’t work

After custom post type registration, that is register_post_type() , try adding function flash_rewrite_rules(); This will automatically flush all rewrite rules so you won’t need to go to permalink settings each time. See this page: https://codex.wordpress.org/Function_Reference/register_post_type#Flushing_Rewrite_on_Activation Example: add_action( ‘init’, ‘my_cpt_init’ ); function my_cpt_init() { register_post_type( … ); flush_rewrite_rules(); } As it’s said in the docs, it’s … Read more

custom post type not showing in menu

// portfolio code function codenovo_portfolio_init(){ $labels = array( ‘name’ => _x(‘Portfolio’, ‘post type general name’), ‘singular_name’ => _x(‘Portfolio’, ‘post type singular name’), ‘add_new’ => _x(‘Add New’, ‘portfolio’), ‘add_new_item’ => __(‘Add New Portfolio’), ‘edit_item’ => __(‘Edit Portfolio’), ‘new_item’ => __(‘New Portfolio’), ‘view_item’ => __(‘View Portfolio’), ‘search_items’ => __(‘Search Portfolio’), ‘not_found’ => __(‘No portfolio found’), ‘not_found_in_trash’ => … Read more

How I can get custom field’s current value?

The author of plugin help me with that. Thanks all. global $post; $product_colors = get_the_terms( $post, ‘product_color’ ); $saved_colors = get_option( ‘nm_taxonomy_colors’ ); if(isset($product_colors) && is_array($product_colors)){ foreach($product_colors as $color){ $term_id = $color->term_id; $hex_code = $saved_colors[$term_id]; echo $hex_code . ‘<br />’; } }

Change the method of a class from child function.php

In you case i am considering this is direct function attached to shortcode. You can create your own shortcode and use it to display what you want. You can try this hack hope it will help you, add_shortcode( ‘custom-bewpi-download-invoice’, ‘print_invoice_func’); function print_invoice_func( $atts ) { if ( ! isset( $atts[‘order_id’] ) || 0 === intval( … Read more

Unique 4 digit number

For unique 4 digit number, the following code work fine function unique_number($length=10) { $string = ”; // You can define your own characters here. $characters = “0123456789”; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters)-1)]; } return $string; } print unique_number(4); Every plugin has extended capability to change the default … Read more