Phill
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Text of new posts not showing on siteHi David,
Have you tried switching themes? Have you also tried deactivating current plugins on-by-one to see if a change of one plugin changes the display.
Have you you checked console for errors?Forum: Developing with WordPress
In reply to: Hide One or More Nav Menu Item from Logged out userLets try the below code:
function hide_menu_conditional($items, $args) { // Check if the menu location is your primary menu if ($args->theme_location == 'primary-menu') { // Check if the USer is logged in if (is_user_logged_in()) { // If the user is logged in , find the menu item with the title 'Store Manager' foreach ($items as $key => $item) { if ($item->title == 'Store Manager') { // Remove the menu item unset($items[$key]); break; } } } } return $items; } add_filter('wp_nav_menu_objects', 'hide_menu_conditional', 10, 2);Forum: Developing with WordPress
In reply to: Custom fieldGreat! You’re welcome!
Forum: Developing with WordPress
In reply to: Custom fieldHello,
if you add the code within code snippets, you don’t need to use a child theme.
- This reply was modified 2 years, 9 months ago by Phill.
Forum: Developing with WordPress
In reply to: Custom fieldYou can put it at the bottom of the file, after the other code. Alternatively you can download a plugin like Code Snippets and drop the code in there (and activate).
If you’re putting in functions.php, it’s best in a child theme as otherwise when you update your theme later you will lose your code.
Forum: Developing with WordPress
In reply to: Changes takes time to reflect on live siteHello, are you using any cache plugin or does your host use a caching system?
This is often a reason why changes are pushed at a slightly later time than when you make the actual update.
Forum: Everything else WordPress
In reply to: WordPress pricing for different local areasHello,
The link to your staging site didn’t work as it was a draft page. Could you recheck and update? I think this will give us a better understanding of what you are trying to achieve 🙂
Forum: Developing with WordPress
In reply to: How to get the Timezone info from Rest API?Hello,
I think the WooCommerce dedicated support forum would be well suited for this one:
Forum: Developing with WordPress
In reply to: Custom fieldYou should remove the final part. So your code would be as below.
I tested on a fresh Blocksy theme and it works as described (not displaying in the front end). Like all code changes, make sure you backup before hand incase of any conflicts.
/** * Function to render UI in Admin Product add/edit page */ function show_custom_price_admin() { global $thepostid; woocommerce_wp_text_input( array( 'id' => 'custom_price', 'name' => '_custom_price', 'value' => get_post_meta( $thepostid, '_custom_price', true ), 'class' => 'wc_input_price short', 'label' => __( 'Custom Price ($)', 'vg' ), ) ); } add_action( 'woocommerce_product_options_pricing', 'show_custom_price_admin' ); /** * Function to update custom price Admin Product add/edit page * * @param int $post_id Product's post id. */ function process_product_custom_data( $post_id ) { $product = wc_get_product( $post_id ); $product->update_meta_data( '_custom_price', wc_clean( wp_unslash( filter_input( INPUT_POST, '_custom_price' ) ) ) ); $product->save(); } add_action( 'woocommerce_process_product_meta', 'process_product_custom_data' );Let me know if it works!
- This reply was modified 2 years, 9 months ago by Phill.
Forum: Installing WordPress
In reply to: Staging a new site for approvalHello, please see my answers
- You could use a sub domain- for example staging.examplesite.com
- Could you give them the front end url once you’re completed ready for approval?
Good luck with the site!
Forum: Developing with WordPress
In reply to: Custom fieldNot sure if you need to hook within the single product page, you can remove that part of the code if needs be.
code goes in functions.php of your child theme or a code snippets plugin.
/** * Function to render UI in Admin Product add/edit page */ function show_custom_price_admin() { global $thepostid; woocommerce_wp_text_input( array( 'id' => 'custom_price', 'name' => '_custom_price', 'value' => get_post_meta( $thepostid, '_custom_price', true ), 'class' => 'wc_input_price short', 'label' => __( 'Custom Price ($)', 'vg' ), ) ); } add_action( 'woocommerce_product_options_pricing', 'show_custom_price_admin' ); /** * Function to update custom price Admin Product add/edit page * * @param int $post_id Product's post id. */ function process_product_custom_data( $post_id ) { $product = wc_get_product( $post_id ); $product->update_meta_data( '_custom_price', wc_clean( wp_unslash( filter_input( INPUT_POST, '_custom_price' ) ) ) ); $product->save(); } add_action( 'woocommerce_process_product_meta', 'process_product_custom_data' ); /** * Function to show custom price front end page */ function show_custom_price_frontend() { global $post; $custom_price = get_post_meta( $post->ID, '_custom_price', true ); if ( $custom_price ) { $custom_price = wc_price( $custom_price ); printf( '<p class="price">%s</p>', $custom_price ); } } add_action( 'woocommerce_before_add_to_cart_form', 'show_custom_price_frontend' );Forum: Fixing WordPress
In reply to: JSON error when opening a blog postSomething is wrong with the data serialization so we get the raw content instead of intended article. It’s tricky to troubleshoot just based on this, but I hope this helps and don’t forget to check your error logs:
- Check plugin theme conflict, console errors.
- Are you using a third party api to get any content? Could be an issue here
- php memory limit- insufficient memory can cause this intermittently
- data corruption at server or database level can cause what is occurring here.
- run a malware scan also incase a vulnerable plugin is causing data corruption.
- This reply was modified 2 years, 9 months ago by Phill.
Forum: Developing with WordPress
In reply to: Automate dataIs the data available on a REST API/ JSON Feed ? If so then you can pull and display as required with a bit of programming.
Alternatively you can use bulk import to posts tool such as WP all import.
Forum: Fixing WordPress
In reply to: JSON error when opening a blog postThe page displays as normal for me. I can’t see any JSON error in the front end.
Forum: Plugins
In reply to: [WooCommerce] Add to cart URL on subscription variation productHi @vitb
Have you tried:https://yourdomain.com/?add-to-cart=88&variation_id=73&attribute_pa_interval=yearly