Skip to content

Instantly share code, notes, and snippets.

View bogdan-mainwp's full-sized avatar

Bogdan Rapaić bogdan-mainwp

View GitHub Profile
@bogdan-mainwp
bogdan-mainwp / mainwp-custom-edit-site-field.php
Created April 11, 2023 16:48
Snippet exapmle for creating a custom field in the edit site form
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>
@bogdan-mainwp
bogdan-mainwp / mainwp-hello-world-extension.php
Created September 11, 2023 16:37
Basic MainWP one-page extension demo
<?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
*/