Skip to content

Instantly share code, notes, and snippets.

@jaapmarcus
jaapmarcus / addbodyclass.php
Last active February 14, 2024 10:35
Extra body class
<?php
function mimified_ads($classes) {
$categories = get_the_category();
if(is_single()){
if(!in_array($categories[0] -> term_id, array(68,69,71,50))){
$classes[] = 'trending-post';
}
}
return $classes;
@jaapmarcus
jaapmarcus / wp_update.sh
Last active November 15, 2021 22:38
Update Wordpress with command line
#!/bin/bash
source /etc/hestiacp/hestia.conf
source $HESTIA/func/main.sh
for user in $($BIN/v-list-users plain | cut -f1 ); do
for domain in $($BIN/v-list-web-domains $user plain | cut -f1); do
echo "Webdomain: $domain"
if [ -f "/home/$user/web/$domain/public_html/wp-config.php" ]; then
cd /home/$user/web/$domain/public_html/
user_exec /usr/bin/wp core update
@jaapmarcus
jaapmarcus / rename-bulk.sh
Last active June 18, 2021 07:53
Rename user package on bulk
#!/bin/bash
old_name="default"
new_name="new_package"
# Update package for existing users
for user in `ls /usr/local/hestia/data/users/`; do
OLD_PACKAGE=$(/usr/local/hestia/bin/v-get-user-value $user PACKAGE)
if [ "$old_name" = "$OLD_PACKAGE" ]; then
/usr/local/hestia/bin/v-change-user-package $user $new_name
fi
@jaapmarcus
jaapmarcus / benelux.sh
Created May 19, 2021 22:24
IP set example
#!/bin/bash
BEL=(
"http://ipverse.net/ipblocks/data/countries/be.zone"
"http://ipverse.net/ipblocks/data/countries/nl.zone"
"http://ipverse.net/ipblocks/data/countries/lu.zone"
)
IP_BEL_TMP=$(mktemp)
for i in "${BEL[@]}"; do
@jaapmarcus
jaapmarcus / nocache.stpl
Created January 11, 2021 23:22
nocache.tpl
server {
listen %ip%:%proxy_port%;
server_name %domain_idn% %alias_idn%;
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
location / {
proxy_pass http://%ip%:%web_port%;
location ~* ^.+\.(%proxy_extentions%)$ {
root %docroot%;
@jaapmarcus
jaapmarcus / gist:db87d7d1086608b7e57e1ce57c752a1f
Created November 17, 2020 13:41
v-add-lets-encrypt-domain
#!/bin/bash
# info: check letsencrypt domain
# options: USER DOMAIN [ALIASES] [MAIL]
# labels: web
#
# example: v-add-letsencrypt-domain admin wonderland.com www.wonderland.com
#
# The function check and validates domain with Let's Encrypt