How to copy an order item meta from the parent to the child order in a Woocommerce Subscription?

I’m running a function hooked to woocommerce_order_status_completed that uses an API to get a phone number and pin from an external source and save that in a meta key on some order items. Some of these order items are subscriptions.

When a Woocommerce subscription renewal order runs automatically, it fires the API and gets a new set of call-in data. I need to check if a completed order is a subscription renewal and if so skip the API call and just get the renewed item’s parent meta data and insert it into the child items meta.

The top portion of the code I have tried here is not working. The API call portion of the code in the else{} is working so I have truncated it.

add_action ( 'woocommerce_order_status_completed', 'add_item_meta_or_run_api', 10 , 1);  function add_item_meta_or_run_api( $  order_id ) {  $  order = wc_get_order( $  order_id );   if (wcs_order_contains_subscription( $  order, 'renewal' )){ //check if the order contains a renewal subscription    foreach ($  order->get_items() as $  item_id => $  item_obj) { //loop through each rewnewal item        $  parent_id = $  item_obj->get_parent_id(); // Get the parent order ID for the subscriptions.       $  parentSubscriptions = wcs_get_subscriptions_for_order( $  parent_id );//get parent order subscriptions                 foreach (  $  parentSubscriptions->get_items() as $  parent_item_id => $  subscription_item_obj) { //loop through parent order items and get the meta.                   $  ParentCallinData = $  subscription_item_obj->get_meta('call_in_data');               // Store parenent item call in data in renewal order item meta         wc_update_order_item_meta($  item_id,'call_in_data',   $  ParentCallinData, true);             }    } }   else {//if there is not a subscription renewal in the order then we run the Api       foreach ($  order->get_items() as $  item_id => $  item_obj) {    //Code here has been removed that builds and runs the API call to dynamically get the call-in data and store it in $  APIresponse          wc_update_order_item_meta($  item_id,'call_in_data',  $  APIresponse, true); //the APIresponse is added to an order item meta key     }    }   } 

Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?

Is this a proper way to load CSS files into my WordPress child theme?

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); add_action( 'wp_enqueue_scripts', 'case_studies_styles' ); add_action( 'wp_enqueue_scripts', 'about_styles' );  function my_theme_enqueue_styles() {     wp_enqueue_style( 'child-style', get_stylesheet_uri(),         array( 'parenthandle' ),          wp_get_theme()->get('Version') // this only works if you have Version in the style header     ); }  function case_studies_styles() {     wp_enqueue_style( 'child-casestudies', get_stylesheet_directory_uri() . '/casestudies.css', array(), rand()); }  function about_styles() {     wp_enqueue_style( 'child-about', get_stylesheet_directory_uri() . '/about.css', array(), rand()); } 

I’m asking because I’ve asked some people to try to load my site, and some of them don’t get the stylesheets at all and just get the blank HTML code.

Also, in the beginning of all CSS files, I have this beginning. Every CSS file has a different version (1.2,1.1,1.0)

/*  Theme Name:   GeneratePress Child  Theme URI:    https://generatepress.com  Description:  Default GeneratePress child theme  Template:     generatepress  Version:      1.2 */ 

wp_remove_object_terms correct way to call child of parent taxonomy in woocommerce

In Woocommerce I am currently able to assigned and unassign a product taxonomy from a product by calling the following.

// to assign wp_add_object_terms ( $  product_id,'in-stock', 'product_cat' );  //to unassign wp_remove_object_terms ( $  product_id,'in-stock', 'product_cat' );  

However how would one achieve this with a child of the parent taxonomy.

Do I need to call the parent and then the childs tag_ID ? Maybe something like below. Can someone clarify how I should correctly format ‘pa_stock&tag_ID=27’ please.

wp_remove_object_terms ( $  product_id,'in-stock', 'pa_stock&tag_ID=27' );  

Just to clarify pa_stock represents the parent taxonomy, tag_ID 27 represents the child taxonomy.

Is there any lore that explains why the feral child is human only

So I was thinking of making a druid a skimmed through the archetypes to see if there was anything good, under racial archetypes saw the Feral Child it was listed as only human for some reason. I showed my dm the flavor text and he also found it odd. That made me curious so I came here to ask.

The flavor text reads as follows

The feral child is an archetype of the druid class, available to human druids.

Some youths, abandoned in the wilderness and then raised by animals, are so connected with their adoptive home and family that they become feral. Suspicious of civilized society, these foundlings often choose allegiance to the wild over their human forebears.

Although it specifically calls for humans I find it hard to believe that humans are the only race who throw unwanted children into the wilderness. Is there anything I’m missing that makes it so that only humans can have this class?

With all that in mind, I ask the question: why are humans the only race that can access feral child. Since we obviously can’t know what the devs were thinking it would probably be more effective to look for lore so let’s go with that.

Next Previous siblings child pages

I tried this piece of code : https://wordpress.stackexchange.com/a/54474/80921 because I couldn’t figure out how to get the next and the previous post. But this code won’t work now and I’m not able to comment.

The error I get is "Undefined offset: -1" when looking for the ID. Here is the full code found on the related page. Thanks for any help !

$  pagelist = get_pages("child_of=".$  post->post_parent."&parent=".$  post->post_parent."&sort_column=menu_order&sort_order=asc"); $  pages = array(); foreach ($  pagelist as $  page) {    $  pages[] += $  page->ID; }  $  current = array_search($  post->ID, $  pages); $  prevID = $  pages[$  current-1]; $  nextID = $  pages[$  current+1]; ?>  <div class="navigation"> <?php if (!empty($  prevID)) { ?> <div class="previous"> <a href="<?php echo get_permalink($  prevID); ?>" title="<?php echo get_the_title($  prevID); ?>">Previous</a>  </div> <?php } if (!empty($  nextID)) { ?> <div class="Next"> <a href="<?php echo get_permalink($  nextID); ?>" title="<?php echo get_the_title($  nextID); ?>">Next</a> </div> <?php } ?> </div> 

Can’t have a front page on a child theme [closed]

I’ve been developing a child theme for busiprof, and had the very poor sense to update busiprof itself. After the update my front page was mostly gone, only the header and footer are displayed. I’ve tried to remove everything but the css file and it does the same. If I activate busiprof I have a front page, if I activate the (supposedly identical) child theme I only get a header and a footer. I’ve tried to link it to a static page but it still won’t display.

Thanks in advance for any help

Issue with Webfont/font-face in child theme

I’ve uploaded a free webfont to my child theme. It’s placed in a folder labelled ‘fonts’. I can’t for the life of me get it to link correctly and work.

This is the code I’m using in the child theme stylesheet

@font-face {   font-family: 'GlacialIndifference';   src: url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Regular.eot'); /* IE9 Compat Modes */   src: url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */        url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Regular.woff2') format('woff2'), /* Super Modern Browsers */        url('http:/MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Regular.woff') format('woff'), /* Pretty Modern Browsers */        url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Regular.ttf')  format('truetype'), /* Safari, Android, iOS */        font-weight: 400;        font-style: normal; }  @font-face {   font-family: 'GlacialIndifference';   src: url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Bold.eot'); /* IE9 Compat Modes */   src: url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */        url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Bold.woff2') format('woff2'), /* Super Modern Browsers */        url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Bold.woff') format('woff'), /* Pretty Modern Browsers */        url('https://MYWEBSITEURL.com/wp-content/themes/atmosphere-child/fonts/GlacialIndifference-Bold.ttf')  format('truetype'), /* Safari, Android, iOS */        font-weight: 700;        font-style: normal; } 

I’ve also tried the following:

@font-face {   font-family: 'GlacialIndifference';   src: url('.../fonts/GlacialIndifference-Regular.eot'); /* IE9 Compat Modes */   src: url('.../fonts/GlacialIndifference-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */        url('.../fonts/GlacialIndifference-Regular.woff2') format('woff2'), /* Super Modern Browsers */        url('.../fonts/GlacialIndifference-Regular.woff') format('woff'), /* Pretty Modern Browsers */        url('.../fonts/GlacialIndifference-Regular.ttf')  format('truetype'), /* Safari, Android, iOS */        font-weight: 400;        font-style: normal; }  @font-face {   font-family: 'GlacialIndifference';   src: url('.../fonts/GlacialIndifference-Bold.eot'); /* IE9 Compat Modes */   src: url('.../fonts/GlacialIndifference-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */        url('.../fonts/GlacialIndifference-Bold.woff2') format('woff2'), /* Super Modern Browsers */        url('.../fonts/GlacialIndifference-Bold.woff') format('woff'), /* Pretty Modern Browsers */        url('.../fonts/GlacialIndifference-Bold.ttf')  format('truetype'), /* Safari, Android, iOS */        font-weight: 700;        font-style: normal; }  

I feel like both of those snippets above should work so I’m at a loss as to what I should try next. I copied the font path directly from cPanel.

Help would be appreciated!

Cheers, Rob

WordPress Child Theme Issue

Hi

I have created a child theme for my blog because I have been offered some advertising and need to hard code it. In truth should have done it before – but never mind.

Anyway the child theme is working except for one thing – the background image on my post. It is a blog about a football team and I have a faded image as a background. However I can't find where I added it to replicate in the child theme. It's not in the style sheet, I've checked (which is why I posted here) – but I can't…

WordPress Child Theme Issue

Ensuring relationship between child tables exists prior to SQL insert

I have a situation where I have three tables: user, assignment and test. A user must have completed an assignment before he can take the test. This means the test table has both both a user foreign key and an assignment foreign key on it.

I could write a sql statement like this: insert into test (name, user_id, assignment_id) values ("final exam", 1, 1) which would check to see if the user and assignment exist before doing the insert. However it would not check to see if the user and assignment were related.

The easy way to solve this problem is to do a separate query before the insert to ensure the user has an assignment. I’m wondering if I can accomplish both in one query though. I’m not all that experienced with constraints or subqueries, both of which could be solutions. Looking for a best practice here as it will be used throughout an application.

Overhead cost of spawning child processes

I am curious as to the overhead cost of spawning child processes using fork in a Linux environment. Suppose I have a C program such as

void run_computation(int x);  int main() {     for (int k=0; k<10; k++) {         if ( fork() == 0 ) {             run_computation(k);             break;         }     }      return 0; } 

Assuming that no global state is modified by run_computation, how efficient in terms of overhead is the setting up of the child processes?

To help understand where I’m coming from, I’d like to write my own regex engine (for self-learning) and am imagining using fork to implement the NFA. So, am I incurring an unreasonable cost in such an implementation compared to other methods?