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 | |
/** | |
* Plugin Name: MainWP Hello World Extension | |
* Plugin URI: https://yourwebsiteurl.com | |
* Description: MainWP Hello World Extension is used for the demo. | |
* Version: 1.0 | |
* Author: Your Name | |
* Author URI: https://yourwebsiteurl.com | |
*/ |
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
add_action( 'mainwp_manage_sites_edit', 'myhook_mainwp_manage_sites_edit', 10, 1 ); | |
function myhook_mainwp_manage_sites_edit( $website ) { | |
$myvalue = apply_filters( 'mainwp_getwebsiteoptions', false, $website, 'my_site_value' ); | |
?> | |
<div class="ui grid field"> | |
<label class="six wide column middle aligned"><?php esc_html_e( 'My Value', 'mainwp' ); ?></label> | |
<div class="ui six wide column" data-tooltip="<?php esc_attr_e( 'My Value', 'mainwp' ); ?>" data-inverted="" data-position="top left"> | |
<div class="ui left labeled input"> | |
<input type="text" id="mainwp_managesites_edit_my_value" name="mainwp_managesites_edit_my_value" value="<?php echo esc_html($myvalue); ?>"/> | |
</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 | |
// 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_comments_widget_limit_string', 'mycustom_mainwp_comments_widget_limit_string', 10, 1 ); | |
function mycustom_mainwp_comments_widget_limit_string( $length = false ) { | |
return 99999; | |
} |
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 | |
// Hide custom branidng for the user with specific ID | |
// Replace ID with actual ID number | |
add_filter( 'mainwp_child_branding_init_options', 'mycustom_mainwp_child_branding_init_options' ); | |
function mycustom_mainwp_child_branding_init_options( $option ) { | |
$current_user_id = get_current_user_id(); | |
if ( $current_user_id == 'ID' && is_array( $option ) && isset( $option[ 'cancelled_branding' ] ) ) { | |
$option[ 'cancelled_branding' ] = true; |
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 | |
// 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_codesnippets_editor_attr', 'myhook_mainwp_codesnippets_editor_attr', 10); | |
function myhook_mainwp_codesnippets_editor_attr( $data ) { | |
$data['height'] = 500; | |
// supported themes: 'erlang-dark', 'night', 'xq-dark', 'xq-light', 'the-matrix', 'eclipse' |
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 | |
// 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_open_hide_referrer', 'myhook_mainwp_open_hide_referrer'); | |
function myhook_mainwp_open_hide_referrer() { | |
return true; | |
} |
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 | |
// Use this snippet in the MainWP Code Snippets Extension (https://mainwp.com/extension/code-snippets/) | |
// Snippet Type: This Code Snippet only returns information from Child Site | |
if ( function_exists( 'sg_cachepress_purge_cache' ) ) { | |
sg_cachepress_purge_cache(); | |
echo "Cache cleared successfully!"; | |
} else { | |
echo "Clearing cache failed!"; |
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 | |
// 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; | |
} |
NewerOlder