Need to forward Data from WooCommerce Webhook sent to same site WordPress REST API custom endpoint

I figured out it could be an Authorization problem, then I looked the WooCommerce webhook functions and fount where the delivery is executed: /wp-content/plugins/woocommerce/includes/class-wc-webhook.php I hard coded my Authorization header after line # 303 in the deliver() function: ‘headers’ => array( ‘Content-Type’ => ‘application/json’, ‘Authorization’ => ‘Basic bmNkaWgdrGFsOiNIb25kdXJhczIwMThTUFMh’, ), Now I need to calculate the … Read more

custom-header not working

Got it working. I had to call the function in my page where I want it to work, the method of doing so is here: https://developer.wordpress.org/themes/functionality/custom-headers/#displaying-custom-header (link provided by Jacob Peattie) and it needs to be within the tags rather than simply a div with an id of site-header.

Collect all events in one year

OK, your events are already sorted by date, so all you have to do is to ignore header, previous event had the same year. Let’s also try to avoid all that spaghetti code, you’ve posted in question: <?php $previous_year = false; while ( $myrow = mysqli_fetch_array($result) ) : $event_datetime = strtotime($myrow[‘event_date’]); ?> <?php if ( … Read more

How does one make a URL return dynamic JSON with custom Content Type?

I asked this on stack overflow as well. You can find that answer here: https://stackoverflow.com/a/56801044/343292 I’ll copy and paste the answer below incase the link ever breaks. It worked for me. I used the dynamic way. ANSWER FROM @Sally CJ Note: I’m assuming WordPress is installed in the root folder. So if you want http://example.com/apple-app-site-association … Read more

Display current user metadata on WordPress page

You can try below snippet of code. i have develop shortcode you can take reference from it. function current_user_data_func( $atts ) { extract( shortcode_atts( array( ‘metakey’ => ”, ‘user_field’ => ”, ), $atts) ); ob_start(); if(is_user_logged_in()) { $current_user = wp_get_current_user(); $c_user_id = $current_user->ID; if(!empty($metakey)) { $value = get_user_meta( $c_user_id, $metakey, true); echo $value; } if(!empty($user_field)) … Read more

Add a default style if no Featured image is selected

You can test if the $thumb has any contents and then apply a class to the featured image block that you can use to hide the container. <?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), ‘full’ ); ?> <div id=”post” class=”featured-image <?php echo empty($thumb) ? ‘no-featured-image-class’ : ”; ?>” style=”background-image: url(‘<?php echo $thumb[‘0′]; ?>’)”>

ACF under category name in shop page [closed]

If i understand you correctly here you want to display some text under each of the category titles on your shop page. Instead of editing the template i would suggest using a hook. To do this you should move your code into functions.php. The complete code would look something like this: add_action(‘woocommerce_after_subcategory_title’, ‘wpse_add_custom_text_under_category_title’, 10); function … Read more