Created
January 11, 2017 17:24
-
-
Save scarstens/31614adc27c9e02fd567c78980cb6534 to your computer and use it in GitHub Desktop.
Site option example of injecting new section and fields into existing sm_options_page or sm_options_container from the fansided-vip plugin
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: an-injected-network-site-option | |
* Description: Site option example of injecting new section and fields into existing sm_options_page or sm_options_container from the fansided-vip plugin | |
* Plugin URI: https://github.com/fansided | |
* Author: sethcarstens | |
* Author URI: https://fansided.com | |
* Version: 0.0.1 | |
* Text Domain: fs | |
* License: GPLv2 or later | |
*/ | |
add_filter('fs_network_options_page', 'videopin'); | |
/** | |
* @param $network_settings sm_options_container | |
* | |
* @return sm_options_container | |
*/ | |
function videopin( $network_settings ){ | |
$network_settings->add_part( $section_video_pin = new sm_section( 'enable_video_pin_s', array ( | |
'title' => 'Video Pin', | |
) ) ); | |
$section_video_pin->add_part( $enable_vidpin = new sm_checkbox( 'enable_video_pin_cb', array( | |
'label' => 'Enable Pinned Video', | |
'description' => 'Pins video to single pages on Desktop-only.', | |
'value' => 'enabled', | |
'classes' => array( 'onOffSwitch' ) | |
) ) ); | |
$enable_vidpin->network_option = true; | |
return $network_settings; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment