Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Site option example of injecting new section and fields into existing sm_options_page or sm_options_container from the fansided-vip plugin
<?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