Update woocommerce thankyou page based on API request result

I create a custom woocommerce payment gateway plugin. First, I call an API, I take the formUrl from the response result then I redirect users to this payment form. At this step everything is Ok.

After the user enter his credit cards info and click validate the system redirect him to the default "order-received" page.

Before loading this page, I want to call another API to check the payment status, if the response body has the orderStatus== 1: I want to show the description in the response body (description = "Request processed successfully"), I reduce order stock, I update the status of order then I display the Order details. If the orderStatus == 2: I want to change the order status to ‘failed’ manually to show the default woocommerce-thankyou-order-failed message (”Unfortunately your order cannot be processed…") in the file thankyou.php or I just show a simple error payment message in this case.

In the payment class constractor I tried adding: add_action( ‘woocommerce_thankyou’, ‘thank_you_page’, 20, 1 ); but I dont know how to add my custom function or how to adapt this requirement.

My plugin looks like this one : https://github.com/YTTechiePress/custom-woocommerce-payment-gateway/blob/master/lesson-1/noob-payment-for-woocommerce.php

Do you gain XP based on your “level” or your XP total?

Let’s say a 3rd-level character with 5900 XP (100 away from reaching 4th level) clears two EL 5 encounters during an adventure. The PHB says on page 58 that XP is handed out at the end of each adventure, so this means they were in both of these encounters while they were 3rd level.

According to the table on page 38 of the DMG, a party of four 3rd-level characters gains 450 XP per character from an EL 5 encounter, whereas a party of four 4th-level characters gains 400 XP per character.

So, at the end of the above example, would the character have gained 900 XP (they were treated as a 3rd level character during the second encounter, because at the time of the encounter they had 3 HDs and the class features of a 3rd-level character, etc.) or 850 XP (they were treated as 4th level during the second encounter, because at the time of the encounter they had between 6000 and 9999 XP)?

rewrite URL based on selected taxonomy for post page

I have a taxonomy called "group", and their values like "red", "blue", "green" (these are generating dynamic" no any fixed group value.

during post publish I am selecting "Group" for each post. 1 group for each post.

I want to add a rewrite URL for the post if the taxonomy is "red" or "blue" or "green" then the URL of that post should come like

"myweb.com/red/post-slug-name" or "myweb.com/green/post-slug-name" or "myweb.com/blue/post-slug-name"

add_action( 'init', 'create_group_tax' ); function create_group_tax() {     register_taxonomy(              'group',              'post',               array( 'label' => 'Group',                      'hierarchical' => true                 )         ); }  add_rewrite_rule('^red/([^/]*)/?','index.php?group=$  matches[1]','top'); 

also, I want to make it regex rule "'^red/([^/]*)/?'" dynamic with selected taxonomy,this time just to make a test i added it as a static string.

result : Page not found. Nothing here – http://localhost/wordpress/red/my-test/

what do you suggest to do this?

Change query based on post type while staying in loop

I have a loop that displays three custom post types.

Thing is, all of these post types use a different logic. ‘elemzesek’ and ‘gyorshirek’ use ACF fields which you can see in the meta_query.

However, the ‘cikkek’ post type, to display the correct articles, would need a

‘tag’ => get_the_title();

The problem is, if this is added, and it runs for ‘elemzesek’ and ‘gyorshirek’ as well, the loops finds no results.

Can someone help me in achieving this?

<?php      $  ceg = get_the_title();     $  ceg_megadasa = get_field('ceg_megadasa');     $  paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;     $  query = new WP_Query( array(         'post_type' => array('cikkek', 'elemzesek', 'gyorshirek'),         'posts_per_page' => 10,         'paged' => $  paged,         'post_status' => 'publish',         // 'tag' => $  ceg,         'orderby' => 'date',         'order' => 'DESC',         'meta_query' => array(             'relation' => 'OR',             array(                 'key' => 'ceg_megadasa',                 'value' => get_the_ID()             ),             array(                     'key' => 'ceg_megadasa_gyorshirek',                     'value' => get_the_ID()                 ),                      )     ) ); ?> 

I do not understand the code version of time based sprite animation?

I’m Universo and for the longest time had coding issues around the concept of time-based sprite animation basically, do not know how to implement it and any code or explanation simple or complex that I’ve found has been extremely confusing to me and was hoping to have a kind person walk me through the code step by step, explaining exactly how this is implemented correctly.

Here’s what, I believe to know about the concept and or idea for time-based sprite animation it is to construct a delay or halt of some code statement using time of some kind in milliseconds with a collection of moving images and or sprites however any attempts from the tutorial’s or my own brain have resulted in inaccurate various speed sprite animations and not the consistent stable speed, Id appreciate and be grateful for here’s some code to show my progress and perhaps help you understand my position in this mess baring in mind, I prefer my code be as extremely simple and speedy as possible within the limitations, of course:

JavaScript with HTML5 Canvas

window.onload = function () {      var canvas = document.getElementById("canvas");      var ctx = canvas.getContext("2d");      var FrameSize = 120; //120 pixels     var FrameNumber = 0; //obvious     var img = new Image();     img.src = 'sprite_ani.png';     var last = 0; // no idea         function Render() {        ctx.clearRect(0,0 ,640,480);       now = performance.now();       delta = now - last; // last is 0, how does this work?       last = now; // last is now, why?        if(delta > 20 //what does this value represent) {          FrameNumber += FrameNumber + 1;          delta = 20;       }                 if(FrameNumber>=4){               FrameNumber = 0;       }          ctx.drawImage(img,FrameSize*FrameNumber,0,120,120,0,0,120,120);          window.requestAnimationFrame(Render);     }     window.requestAnimationFrame(Render);    }     

As you can see, it’s extremely simple yet, I’m still struggling to not only understand it but extremely simply implement it, I’m not a fan of over-complicated coding hence why I ditched c++ ages ago.

Could someone in extremely simple english guide me through time-based sprite animation in the context of JavaScript preferably, Id also really appreciate various time-based sprite animation methods being explained too in extremely simple terms but not holding out, I thank you for reading this far.

Pls how do I setup a from and to address and allow my UPS integrated solution calculate shipping based off the two addresses? [closed]

So, I am setting up a website to handle shipping services similar to DHL and UPS, but I am also using UPS services to handle the shipping cost through their API to my specific users, and I want to be able to calculate shipping by allowing users to enter a from and to shipping address, and calculate the shipping based on the distance. Any help would be much appreciated.

How can you build an effective character based on thrown weapons?

I am trying to think of good ways to build an effective D&D 5e character whose strong point is with thrown weapons. The hangup seems to be drawing them fast enough. Thrown weapons seem to be less effective than either melee or ranged weapons, either of which you can work up to 3 or 4 attacks per Attack action if you do it right, and use the appropriate feats. Thrown weapons seem to max out at 2 attacks per Attack action, and even to get that you need the Dual Wielder feat.

Has anyone worked out a way, consistent with the rules, to make thrown weapons not be so hobbled by this, other than finding a Dwarven Thrower?

“Tarot” based RPG?

When I was young (late-90s?) my brother and I were given a game that we never played. I opened it once and found it utterly impenetrable.


There wasn’t a board or anything concrete like figurines, nor a specific "thing" we were supposed to do. And we were supposed create characters somehow by dealing cards out of a deck that seemed to be a sort-of Tarot-like sort of thing, but also with some Ancient Western "4 elements/humours" stuff going on. And then someone would ask us what we wanted do, and we’d tell them, and they’d draw another card from a Tarot deck and tell us what was happening. WTF!???!?

It all seemed very confusing, and definitely seemed like we needed someone else who already knew what they were doing, in order to play. And we didn’t have anyone else; so we never played.

Looking back now, I strongly suspect that this was an open-world, very flexible and hand-way RPG game, where a Tarot deck is used instead of d20s, for character-generation and action resolution.

My recollection is that it came in a square box, maybe 14" x 14" x 4". I’d say that the box was predominantly white.

I’ve got a very vague recollection that the name had the word "Quest" in it? If you really forced me to guess I would have said it was called EverQuest. But looking that up, it’s definitely RPG, but also definitely not remotely what I’m thinking of?

FWIW I would have said that the production values of, e.g. the rule book were very high. But I was ~10 at the time, so :shrug:.

Can anyone identify this game/system, for me?

I’ve tried searching things like "DnD but with Tarot" but all I get is stuff about how to work Tarot decks into actual DnD games 😀

Obviously, since this was >20 years ago, and we didn’t ever actually play the game, it’s entirely possible that I’ve misremembered some details (or indeed, that I’ve correctly remembered my own misunderstandings!) Apologies if so; hopefully there’s enough that’s correct to identify it.

Shocking result from new Lighthouse based GTMetrix analysis

The recent GTM upgrade has thrown me a curveball. Sites that were in the 90s for both measures are now scoring Ds and Es in the new Lighthouse tests. AND they don’t give much info as to why.

I went over to PSI and ran their tests again and began to home in on some of the issues which were not issues under old GTM are now issues, specifically for mobile tests.

Nearly all the errant javascript was Google’s! They want me to be fast to score well for good SEO but not use their Adsense code, not use their web fonts, not use their Captcha code (I could go on!).

Caveat: I don’t have the skills to build anything other than a very basic static site by hand – though I have many of them live for simple needs cases. Most clients was bells and whistles and sliders (I know!) and snazzy forms with dropdowns and Captcha etc. etc. So I have a small handful of WP themes which have always served me well.

The sites which are my most important run WP-Rocket, through Cloudflare, and have a paid-for CDN too (Bunny) so you can’t say I don’t try!

I have changed my choice of form plugin because CF7 was loading Captcha code on every page and have worked our how to stop Sider Revolution code loading on every page too. nicomorgan.co.uk

Still scoring 15% on one site which feels fast when loaded on my phone. johnsonsofoldhurst.co.uk

I feel like I’m banging my head against a wall. People want images, they want interactive elements – Google says I can’t have them!

Any tips gratefully received.