This file contains hidden or 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
/** | |
* Snippet Action: Redirect user if not logged in. | |
* Snippet Author: Keith Crain ( MainWP.com ) | |
*/ | |
function custom_template_redirect_fn() | |
{ | |
if( ! is_user_logged_in ) { | |
{ | |
$loginUrl = wp_login_url(); |
This file contains hidden or 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 | |
/** | |
* Snippet Action: Get all users that are not Administrators | |
* Snippet Type: Return info from Child Sites. ( IMPORTANT! This will make it run one time ) | |
* Snippet Author: Keith Crain ( MainWP.com ) | |
* | |
* Output: | |
* Total User Count: 5 | |
* UserName1 : customer |
This file contains hidden or 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
/** | |
* Snippet Action: Add Site Name to pdf file. | |
* Snippet Type: MainWP Custom Dashboard CSS snippet. | |
* Snippet Author: Keith Crain ( MainWP.com ) | |
*/ | |
add_filter( 'mainwp_pro_reports_pdf_filename', 'mycustom_mainwp_pro_reports_pdf_filename', 10, 3 ); | |
if ( !function_exists( 'mycustom_mainwp_pro_reports_pdf_filename' ) ) { | |
function mycustom_mainwp_pro_reports_pdf_filename( $filename, $report, $site_id ) { | |
$website = MainWP\Dashboard\MainWP_DB::instance()->get_website_by_id( $site_id ); |
This file contains hidden or 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 | |
/** | |
* Snippet Action: Append content to Robots.txt | |
* Snippet Type: Return info from Child Sites. ( IMPORTANT! This will make it run one time ) | |
* Snippet Author: Keith Crain ( MainWP.com ) | |
*/ | |
// The string you want to add. | |
$txt = " |
This file contains hidden or 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
define( 'WP_MEMORY_LIMIT', '128M' ); | |
ini_set("default_socket_timeout", 600); | |
/* That's all, stop editing! Happy blogging. */ |
This file contains hidden or 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
/** | |
* 1.) Upload your logo to WP Media Library | |
* 2.) Copy the URL from Media Library | |
* 3.) Paste on line 13 | |
*/ | |
/* Hide Original logo */ | |
.mainwp-nav-wrap #mainwp-logo img { | |
display: none!important; | |
} |
This file contains hidden or 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 | |
/** | |
* Snippet Action: Trigger Elementor DB Update. | |
* Snippet Type: Return info from Child Sites. ( IMPORTANT! This will make it run one time ) | |
* Snippet Author: Keith Crain ( Kronoslabs.io ) | |
*/ | |
add_action( 'plugins_loaded', 'klbs2345_trigger_elementor_db_update' ); | |
function klbs2345_trigger_elementor_db_update() { |
This file contains hidden or 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
/** | |
* Snippet Action: Return Child Site Posts. | |
* Snippet Type: Return info from Child Sites. | |
*/ | |
$posts = get_posts( array( | |
'post_type' => get_post_types(), | |
'post_status' => 'publish', | |
'numberposts' => -1, | |
) ); |
This file contains hidden or 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
$upload_dir = wp_upload_dir(); | |
$folder = $upload_dir['basedir']; | |
$files = list_files( $folder ); | |
foreach ( $files as $file ) { | |
if ( is_file( $file ) ) { | |
$filesize = size_format( filesize( $file ) ); | |
$filename = basename( $file ); | |
echo esc_html( $filename . " - (" . $filesize ) . ")<br />"; | |
} | |
NewerOlder