Call WC_Product get_price()?

Regarding the filter, you tried, not working, my hunch is that it’ not working, because it’s missing (priority and) accepted arg count parameter(s). At the moment add_filter(‘woocommerce_product_get_price’, ‘test_change’); Defaults to priority 10 and 1 parameter for your callback, but you’re using two args in function test_change($value, $prop) { return 666; } Thus you’d need to … Read more

how can i add class or span tag at sprintf?

Actaully using esc_html won’t help because it will escape any html character, so you have to depend on wp_kses so you can specify the accepted tags and there attributes, so no need then to escape the output. but you have to escape the values comming from DB, which in you case $average_rating. so your can … Read more

Why my loop isn’t working? [closed]

I’m not 100% sure what you’re trying to do with this. Out of the Box, WordPres allows you to set your home page as either a static page, or a blog. If you choose blog, it will automatically output title and content for you. If you’re trying to customize a static home page, then you’ll … Read more

User Meta Value not echoing despite Var_Dump Showing correct string

The $havemeta variable isn’t defined inside your shopping_location_text() function, so it isn’t available for use there. For a quick fix (or for testing/toying) you can move your code inside the function, like this: add_action( ‘woocommerce_before_main_content’, ‘shopping_location_text’, 10 ); function shopping_location_text() { global $current_user; get_currentuserinfo(); // wordpress global variable to fetch logged in user info $userID … Read more

Capture form data in one function and use it in another function (same file)

You could use WordPress Transients to temporarily set a variable in the WP database with one function, and get that variable with another function. function setPrice(){ $myPrice = $_POST[‘price’]; set_transient( ‘ex1_temp_price’, $myPrice, 28800 ); // Site Transient } // this function can be kicked off the shortcoe, within the transient timeout function use_price(){ $price = … Read more

Where can I find the inline-css of my theme header?

That part of the page layout is most often inside of the header.php file in your theme root folder. But before you edit that file directly, a few advices: Do you use a child theme? If not, or you are not sure, than it is not advised to edit that file directly, because when the … Read more