wordpress

  1. L

    Change product status if prices are updated in Woocommerce 3

    I need to change product post_status in a hook. I trying to make product get back to "pending" status everytime vendor change the price. add_action( 'updated_post_meta', 'mp_sync_on_product_save', 10, 4 ); function mp_sync_on_product_save( $meta_id, $post_id, $meta_key, $meta_value ) { if (...
  2. I

    WordPress.org theme submission

    I have approved 2 WordPress theme on ThemeForest. I know better about Themeforest theme submission guidelines. But it's time I am going to submit a theme on WordPress.org repository. My Question is. could I include Third-party WordPress plugin in my theme from WordPress repository? if you know...
  3. S

    Avoid fatal error on update_checkout event when Calculating Shipping in WooCommerce

    I want to calculate shipping when update_checkout triggered. i used below code in my plugin function function action_woocommerce_checkout_update_order_review($array, $int) { WC()->cart->calculate_shipping(); return; } add_action('woocommerce_checkout_update_order_review'...
  4. O

    Avoid cart items price update for specific product categories in Woocommerce

    I am using below script under my WordPress child theme functions.php to overwrite price, but below code is affecting to all the products. Can you please help me "not to run" below code if the product is under some specific "shirts", "games" category? function calculate_cart_total( $cart_object...
  5. J

    WordPress: get_page_children of an existing page's ID returning empty array

    The page whose ID equals 7 is defined as being the parent of 2 pages (done in back-office). I created this shortcode: add_shortcode('display_children_pages', function($params) { $html_to_display = ''; echo "<pre>"; var_dump(get_the_ID()); echo "</pre>"; echo "<pre>"...
  6. M

    Getting the wrong timezone when outputting user registration date in Wordpress

    I'm trying to output user registration time in the local timezone, but Wordpress stores the user_registeredvalue in UTC format. Backend settings are set to be +2h. The following code: $user_registered = $user_info->user_registered; will display the UTC time like 2018-10-25 15:04:45, where I...
  7. B

    Show content on button click then hide that button

    I am using Wordpress and I have an Iframe game that I want to prevent this game from running until the button (play game) is clicked. So I want to create a div area (something like a button) when it is clicked the game will display, and that div area disappear. Here is the code that I use...
  8. M

    Conditionally updating roles on number of posts published?

    I want conditionally updating user roles based on the number of post. As an example, when a user reaches 5 post, the subscriber role is automatically upgraded to the editor role. How can I do this with the code below? (This code only changes its role if the user logs in.) function...
  9. B

    Auto complete processing orders based on their total amount in Woocommerce 3

    In Woocommerce, I am trying to auto complete processing orders based on their total amount. For the moment I have this code that is auto-completing all orders with processing status: add_action( 'init', 'auto_update_orders_status_from_processing_to_completed' ); function...
  10. L

    Notice: Trying to get property of non-object in /wp-content/themes/my-theme/header.php on line 277

    The code below is used to display a random banner image if you are on the page Services, or if you are of a child page of page id 1531, 1567 or 1533. However, when I hit a page not found on a site I get the error mentioned in the title of this question above the banner image. Below is the code...
  11. D

    Adding custom text to the variation price in Woocommerce

    I thought this would have been easy, but I am stuck. All I am trying to do is add the word each after the variation price on a product page. The solution I have found adds it on the category page and in two places on the product page. The code is: /* Adds a text Each - after price */ function...
  12. S

    Custom Page Titles and Descriptions on WooCommerce Category Pages

    I have used Advanced Custom Fields to add a custom page title field on all of my pages, posts, categories and products. In order to remove the default <title> tag and ensure this field pulls through correctly, I have used the following function inside my functions.php file: /* Remove Default...
  13. P

    Include a php variable in json schema data - wordpress site - invalid json error

    <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "LocalBusiness", "name": "storename", "image": "https://staticqa.store.com/wp-content/themes/faf/images/store-logo.png", "@id": '.json_encode($storeid)'., "url": "", "telephone"...
  14. B

    Wordpress shortcode is being inserted before content

    I know we have have to return the shortcode but I'm trying to use custom templates and the shortcode is being inserted before the content in the wysiwyg editor when its actually at the end of the content: Here is my shortcode: add_shortcode('test_temp', 'temp_handler'); function...
  15. S

    Upgrading to PHP 7.1

    I have a quick question about upgrading my theme file to PHP 7.1. I know it's easy to do, but I don't understand PHP. It is currently in an old compatibility of 5.3 and this is the only error in 2 parts of my theme: "ERROR | Using a call-time pass-by-reference is deprecated since PHP 5.3 and...
  16. T

    Wordpress Shortcode Function displays included file above all content

    This is my function: function include_product_table( $atts ) { $a = shortcode_atts( array( 'tablename' => '' ), $atts ); $tablefile = '/home/panacol1/data/wp-content/themes/Divi-child/producttables/pt-'.$a[ 'tablename' ].'.php'...
  17. E

    Send variable to PHP file

    In a WordPress post I'm trying to send data to a PHP file stored in the root folder of my website with this code: <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"> console.log('hi'); var cen = document.getElementById("centro").value; $.ajax({...
  18. S

    WordPress pages specified Menu

    Dears, I need to customize pages in header and footer so I write `<?php $args = array('theam_location' => 'Primary'); ?> <?php wp_nav_menu( $args ); ?>` in header And write `<?php $args = array('theam_location' => 'Footer' ); ?> <?php wp_nav_menu( $args ); ?>` in footer And in...
  19. R

    Wordpress: how to hook get_the_post_thumbnail_url() function

    I'm new to Wordpress. What I am trying to do is to hook the get_the_post_thumbnail_url() and return slightly different URL. I know that I can use WP add_action() for hooking. If I write my function and return required string how can I make sure that the get_the_post_thumbnail_url() will return...
  20. H

    Returning the Post Slug

    Is it possible for me return the Post Url attached to a custom taxonomy on WordPress? I have done something like this. $taxonomy = 'series'; $tax_terms = get_terms( $taxonomy, $args ); print_r($tax_terms); how ever this only returns the following. [0] => WP_Term Object ( [term_id] => 7447...
Top