Skip to content

Instantly share code, notes, and snippets.

@zackpyle
zackpyle / *Best Snippets*
Last active May 1, 2024 20:05
Best PHP/JS Snippets
This is a collection of my most used or most useful PHP and JS snippets
**Disclaimer, I didn't write most of these - I just curated them over the years**
@bogdan-mainwp
bogdan-mainwp / premium-plugin-updates.php
Last active May 14, 2020 01:36
Support for the Premium Plugin updates
<?php
// Add the following code snippet to the PHP section of the MainWP Custom Dashboard Extension or the functions.php file of the active theme on your Dashboard site.
add_filter( 'mainwp_detect_premium_plugins_update', 'myhook_mainwp_detect_premium_plugins_update', 10 );
function myhook_mainwp_detect_premium_plugins_update( $premiums ) {
// add plugin info (slug) here. In this example, we used Elementor Extras, but you should replace it with the correct plugin info
$premiums[] = 'elementor-extras/elementor-extras.php';
return $premiums;
}
@bogdan-mainwp
bogdan-mainwp / specific-time-for-emails.php
Last active April 16, 2020 11:56
Set specific time for email notifications about Trusted Updates
<?php
// Add the following code snippet to the PHP section in the MainWP Custom Dashbaord plugin
add_filter( 'mainwp_updatescheck_sendmail_at_time', 'mycustom_mainwp_updatescheck_sendmail_at_time', 10, 1 );
function myhook_mainwp_updatescheck_sendmail_at_time( $hour ) {
$hour = '12:00'; // send email notifactions after 12:00
return $hour;
}
#facebook marketplace
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from pymongo import MongoClient
class App:
@bogdan-mainwp
bogdan-mainwp / add-sites.php
Created May 30, 2018 12:28
Custom filter for adding new sites to MainWP Dashboard
<?php
// Available parameters: url, name, wpadmin, unique_id, groupids, ssl_verify, ssl_version, http_user, http_pass
$params = array(
'url' => 'demosite.com',
'name' => 'Site Friendly Name',
'wpadmin' => 'adminusername',
'unique_id' => 'unique_id'
);
@bogdan-mainwp
bogdan-mainwp / custom-report-pdf-paper-size.php
Last active January 12, 2021 11:14
Custom code snippet for setting the custom paper size for the client report PDF.
<?php
// Add the following code snippet to the functions.php file of the MainWP Customisations plugin
// Download MainWP Customisations here: https://github.com/mainwp/mainwp-customisations
// More about the plugin: https://mainwp.com/mainwp-customisations/
add_filter( 'mainwp_client_report_pdf_page_format', 'mycustom_pdf_page_format', 10 , 1 );
function mycustom_pdf_page_format( $format = '' ) {
return 'A4';
}
@carlosonweb
carlosonweb / bb-loop-query-args.php
Last active February 14, 2020 18:57
Beaver Builder Filter Hook: fl_builder_loop_query_args To Filter by Meta Keys
/**
* Add this to the child theme's functions.php file.
*/
add_filter( 'fl_builder_loop_query_args', function( $query_args ){
$today = date( 'd.m.Y', time() );
// Past ( today > start_date )
if ( 'PAST_POST_MODULE_ID_HERE' == $query_args[ 'settings' ]->id ) {
$query_args[ 'meta_query' ] = array(
'key' => 'end_date',
@k4zuki02h4t4
k4zuki02h4t4 / wordmove_with_localbyflywheel.sh
Last active January 30, 2021 07:37
Enable Wordmove with "Local by Flywheel".
#!/usr/bin/env bash
set -xu
RUBY_VERSION=2.4.1
LIBSSL_VERSION=$(dpkg -s libssl1.0.0 | grep -i ^version | awk '{print $2;}')
apt-get update -y
apt-get upgrade -y
apt-get install -y software-properties-common python-software-properties vim build-essential git python-setuptools ruby-build libssl-dev=${LIBSSL_VERSION}
@lukecav
lukecav / Advanced Options Settings (Improved)
Last active May 23, 2018 11:15
MainWP Dashboard - Advanced Options (Performance)
Cross IP Settings
Maximum simultaneous requests 0 Default: 4
Minimum delay between requests (milliseconds) 50 Default: 200
IP Settings
Maximum simultaneous requests per ip 0 Default: 1
Minimum delay between requests to the same ip (milliseconds) 100 Default: 1000
Frontend request Settings
Maximum simultaneous sync requests 24 Default: 8
#!/bin/bash
wp core download --version=4.5
wp core config --dbname=$1 --dbuser=root --dbhost=127.0.0.1
wp db create
wp core install --skip-email --title="$1" --admin_user="shawn" --admin_password="shawn" --admin_email=shawn@actionable.co --url=http://wcroc.dev/
wp theme install simone --activate
wp plugin delete hello
wp plugin install any-ipsum;
wp plugin install advanced-custom-fields --version=4.4.0 --activate
wp plugin install tinymce-advanced --activate