Skip to content

Instantly share code, notes, and snippets.

View fernandovbs's full-sized avatar

Fernando Vinícius Batista de Souza fernandovbs

  • ID5 Marketing de resultados
  • Maceió, Brazil
View GitHub Profile
function add_audima_script() {
wp_enqueue_script( 'audima-script', 'https://audio.audima.co/audima-widget.js', false );
}
add_action( 'wp_enqueue_scripts', 'add_audima_script' );
function audima_the_content( $content ) {
$custom_content = '<div id="audimaWidget"></div>';
$custom_content .= $content;
return $custom_content;
<script type="text/javascript">
let scriptWeni = document.createElement("script");
scriptWeni.src = 'https://storage.googleapis.com/push-webchat/wwc-latest.js';
scriptWeni.async = true;
scriptWeni.onload=chatLoader;
const firstScriptFromPage = document.getElementsByTagName('script')[0];
firstScriptFromPage.parentNode.insertBefore(scriptWeni, firstScriptFromPage);
function chatLoader() {
@fernandovbs
fernandovbs / Commands
Created December 1, 2022 15:01 — forked from lukecav/Commands
Bulk update all product posts in WooCommerce with a post status of publish or draft using a WP-CLI command
# Bulk update all product posts with a post status of publish to draft
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=publish | xargs wp post update --post_status=draft
# Bulk update all product posts with a post status of draft to publish
wp post list --field=ID --post_type=product --posts_per_page=500 --post_status=draft | xargs wp post update --post_status=publish
@fernandovbs
fernandovbs / cheat-sheet.asp
Created November 18, 2022 16:15 — forked from nicoxxxcox/cheat-sheet.asp
Classic ASP/VBSCRIPT Cheat sheet
' Declare a variable and affect a string value
dim myvariable
myvariable = "Donald Duck"
' Change a variable value
dim myvariable
myvariable = "Donald Duck"
myvariable = "Mickey Mouse"
' Concatenate strings
@fernandovbs
fernandovbs / wp_cli_command_in_bulk2.sh
Last active October 31, 2022 22:15
Update post type for post from specific category
#Update post type for posts from category
wp post list --category_name=artigos --field=ID | xargs wp post update --post_type=blog
#Count number of posts from all post types (except posts with other status like inherit)
wp post list --post_type=$(wp post-type list --field=name --format=json) --post_status=publish,trash,draft --format=count
@fernandovbs
fernandovbs / resize.sh
Created September 28, 2022 14:22
force resize update digitalocean volume
#resize2fs filesystem
#Ex:
resize2fs /dev/sdb
@fernandovbs
fernandovbs / autoload.sql
Created September 27, 2022 17:45
Get wordpress autoload size
SELECT SUM(LENGTH(option_value)) as autoload_size FROM wp_options WHERE autoload=’yes’;
@fernandovbs
fernandovbs / varnish.sh
Created July 7, 2022 22:06
Purge varnish cache for css files
sudo varnishadm ban req.http.host == host.com.br '&&' req.url '~' '\\.css$'
@fernandovbs
fernandovbs / wc_membership_user_plan.sh
Last active June 15, 2022 22:23
Bulk update wc membership user plans for all customers
wp wc user_membership list --field=id --user=id5 --allow-root | xargs -n1 wp wc user_membership update --plan_id="274" --user=USER_NAME
#wp wc user_membership list can limit the results. An alternative is to use wp post list to get all membership posts:
wp post list --post_type=wc_user_membership --field=ID | xargs -n1 wp wc user_membership update --plan_id="274" --user=USER_NAME