This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete pages | |
* @link https://developer.wordpress.org/reference/functions/wp_delete_post/ | |
*/ | |
function apsolut_delete_multiple_pages_from_plugin() { | |
// Set an array of page IDs to delete | |
$page_ids = array(1, 2, 3); // Hello World, Homepage, Privacy Policy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ { | |
add_header Vary Accept; | |
if ($http_accept ~* "webp"){ | |
set $imwebp A; | |
} | |
if (-f $request_filename.webp) { | |
set $imwebp "${imwebp}B"; | |
} | |
if ($imwebp = AB) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function change_yoast_seo_og_meta() { | |
add_filter( 'wpseo_opengraph_desc', 'change_desc' ); | |
} | |
function change_desc( $desc ) { | |
// This article is actually a landing page for an eBook | |
if( is_singular( 123 ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Updates product prices. | |
* More about WP CLI scripts: | |
* https://wptheming.com/2021/05/wp-cli-scripts-and-woocommerce/ | |
* | |
* wp eval-file update-product-prices.php | |
*/ | |
$products = get_posts([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
More recent resolution: | |
1. cd ~/../../etc (go to etc folder in WSL). | |
2. echo "[network]" | sudo tee wsl.conf (Create wsl.conf file and add the first line). | |
3. echo "generateResolvConf = false" | sudo tee -a wsl.conf (Append wsl.conf the next line). | |
4. wsl --terminate Debian (Terminate WSL in Windows cmd, in case is Ubuntu not Debian). | |
5. cd ~/../../etc (go to etc folder in WSL). | |
6. sudo rm -Rf resolv.conf (Delete the resolv.conf file). | |
7. In windows cmd, ps or terminal with the vpn connected do: Get-NetIPInterface or ipconfig /all for get the dns primary and | |
secondary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### TRY | |
### https://gitmemory.cn/repo/nezhar/wordpress-docker-compose/issues/74 | |
### | |
### | |
### | |
### | |
version: "3.9" | |
services: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* https://docs.woocommerce.com/document/composite-products/composite-products-js-api-reference/ | |
* https://wordpress.stackexchange.com/questions/342148/list-of-js-events-in-the-woocommerce-frontend | |
*/ | |
//Woocommerce Checkout JS events | |
$( document.body ).trigger( 'init_checkout' ); | |
$( document.body ).trigger( 'payment_method_selected' ); | |
$( document.body ).trigger( 'update_checkout' ); | |
$( document.body ).trigger( 'updated_checkout' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$query = new WP_Query([ | |
// Standard query args. Using post__in can be much faster. If searching ACF custom | |
// database tables data, plugin the found post IDs in here. | |
'post_type' => 'post', | |
'post__in' => [1,2,3], // array of post IDs | |
// Optional args to improve performance. Use these to cut down on internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
window.fwp_is_paging = false; | |
$(document).on('facetwp-refresh', function() { | |
if (! window.fwp_is_paging) { | |
window.fwp_page = 1; | |
FWP.extras.per_page = 'default'; | |
if (FWP.loaded) { | |
$('#pagination .container').prepend('<div class="decom-loading">Loading...</div>'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* custom CPT `faqs` with taxonomy `faq_categories` | |
* section_faq_category is field Taxonomy with Term Object, multi select | |
* faq counter and definitions for terms | |
* loop taxonomy selected taxes with ACF | |
* tax_ID, array of IDs | |
* | |
*/ | |
$faq_object = get_sub_field('section_faq_category'); |
NewerOlder