Untitled Snippet

// Define the API URL const apiUrl = ‘https://api.example.com/data’; // Make a GET request fetch(apiUrl) .then(response => { if (!response.ok) { throw new Error(‘Network response was not ok’); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => {…Continue reading

CONNECT TO API GATEWAY

// Define the API URL const apiUrl = ‘https://api.example.com/data’; // Make a GET request fetch(apiUrl) .then(response => { if (!response.ok) { throw new Error(‘Network response was not ok’); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => {…Continue reading

MemberPress: Bulk Delete All Expired Subscriptions

function mepr_delete_expired_txns() { $subscriptions = MeprSubscription::get_all(); if( is_array( $subscriptions ) && !empty( $subscriptions ) ) { foreach( $subscriptions as $subscription ) { $subscription = new MeprSubscription( $subscription->id ); if( $subscription->is_cancelled() && $subscription->is_expired() ) { $subscription->destroy(); } } } } add_action(…Continue reading

AIOSEO FAQ Block accordion

;(() => { const accordionItems = document.querySelectorAll(“.wp-block-aioseo-faq”); if (!accordionItems.length) { return; } accordionItems.forEach((item) => { const itemSummary = item.querySelector(“.aioseo-faq-block-question”); const itemContent = item.querySelector(“.aioseo-faq-block-answer”); itemSummary?.addEventListener(“click”, () => { itemContent?.style.setProperty( “–content-height”, `${itemContent.scrollHeight}px` ); item.classList.toggle(“is-open”); }); }); const faqStyles = ` .wp-block-aioseo-faq {…Continue reading