Return the ID of the selected terms to array

My terms have an additional ACF true/false field. I need to get a list of all the term IDs with the field enabled and return a list of these IDs. So far I have achieved such a code, but it returns me only one ID: [php]function terms_exclude_id_func() { $terms_control = get_terms([ ‘taxonomy’ => ‘product_cat’, ‘hide_empty’ … Read more

What are the different ways to detect home page in wordpress

What are the different ways to detect wordpress homepage except is_front_page() and is_home() Best Answer is_front_page() is what you want. I assume, by the fact that is_home() is not working, that your home page is static, according to the settings in wp-admin. is_home() returns true on your main blog page whereas is_front_page() returns true on which ever page is defined as your front page, … Read more

WordPress and best practice with passive event listeners

So I have run an audit on a website in chrome and google says I should use passive event listeners. I have looked through the code and identified it’s coming from the wordpress emoji integration: [code lang=”js”]/*<![CDATA[*/window._wpemojiSettings={"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/72×72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.3\/svg\/","svgExt":".svg","source":{"concatemoji":"https:\/\/mysite.com.au\/blog\/wp-includes\/js\/wp-emoji-release.min.js?ver=14BexZMoP1gqvSbLZSfYigjUvfcXkroScK"}};!function(a,b,c){function d(a){var b,c,d,e,f=String.fromCharCode;if(!k||!k.fillText)return!1;switch(k.clearRect(0,0,j.width,j.height),k.textBaseline="top",k.font="600 32px Arial",a){case"flag":return k.fillText(f(55356,56826,55356,56819),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,56826,8203,55356,56819),0,0),c=j.toDataURL(),b===c&&(k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447),0,0),b=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447),0,0),c=j.toDataURL(),b!==c);case"emoji4":return k.fillText(f(55358,56794,8205,9794,65039),0,0),d=j.toDataURL(),k.clearRect(0,0,j.width,j.height),k.fillText(f(55358,56794,8203,9794,65039),0,0),e=j.toDataURL(),d!==e}return!1}function e(a){var c=b.createElement("script");c.src=a,c.defer=c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i,j=b.createElement("canvas"),k=j.getContext&&j.getContext("2d");for(i=Array("flag","emoji4"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);/*]]>*/</script> <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cstyle%20type%3D%22text%2Fcss%22%3Eimg.wp-smiley%2Cimg.emoji%7Bdisplay%3Ainline%20!important%3Bborder%3Anone%20!important%3Bbox-shadow%3Anone%20!important%3Bheight%3A1em%20!important%3Bwidth%3A1em%20!important%3Bmargin%3A0%20.07em%20!important%3Bvertical-align%3A-0.1em%20!important%3Bbackground%3Anone%20!important%3Bpadding%3A0%20!important%7D%3C%2Fstyle%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="&lt;style&gt;" … Read more

How to WooCommerce Change Loading Spinner Icon

I am trying to change the WooCommerce loading spinner icon. It’s defined in the woocommerce.css: [php].woocommerce .blockUI.blockOverlay::before { height: 1em; width: 1em; display: block; position: absolute; top: 50%; left: 50%; margin-left: -.5em; margin-top: -.5em; content: ”; -webkit-animation: spin 1s ease-in-out infinite; animation: spin 1s ease-in-out infinite; background: url(../images/icons/loader.svg) center center; background-size: cover; line-height: 1; text-align: … Read more

How to Change WooCommerce Checkout Layout

In the “woocommerce/templates/checkout” folder there is a file called “form-checkout.php”. Copy the contents of that file to “yourtheme/woocommerce/checkout/form-checkout.php” On line ~54 there is the following code: [php]<?php do_action( ‘woocommerce_checkout_order_review’ ); ?>[/php] Move that to just below: [php]<form name="checkout" method="post" class="checkout" action="<?php echo esc_url( $get_checkout_url ); ?>">[/php] and add: [php]<?php $order_button_text = apply_filters( ‘woocommerce_order_button_text’, __( ‘Place … Read more

How to Add Background Images in WordPress – as Like CSS

PHP code cannot run in .css file, however you can use inline style, such as: [php]<div style="background-image: url("<?php //url ?>");">[/php] OR [css].class-name { background-image: url("<?php //url ?>"); }[/css] The above would be useful when working with custom fields for dynamic image paths. If the image is located in the theme directory, PHP won’t be needed, let’s say … Read more