PHP code example of newcity / newcity-wp-shortcodes
1. Go to this page and download the library: Download newcity/newcity-wp-shortcodes library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
newcity / newcity-wp-shortcodes example snippets
// Check for existence of newcity-wp-shortcodes plugin
if ( class_exists('NewCityShortcodes')) {
// Set value for `newcity_shortcodes_options` only if it does not exist yet
function set_nc_shortcode_options() {
$options = array(
'enabled_shortcodes' => array(
'custom_blockquote',
'local_script',
'inline_media',
)
);
update_option('newcity_shortcodes_options', $options, '', 'yes');
}
// Disabled checkboxes in settings window by setting `"permanent"` to `true`
// in the plugin's options
function lock_shortcodes_settings() {
$current_options = get_option('newcity_shortcodes_options', false);
$locked_options = array_merge($current_options, array('permanent' => array('enabled_plugins')));
update_option('newcity_shortcodes_options', $locked_options, 'yes');
}
// Check if you need to set the enabled shortcodes each time a page loads
add_action('init', 'set_nc_shortcode_option');
add_action('init', 'lock_shortcodes_settings');
}
// Check for existence of newcity-wp-shortcodes plugin
if ( class_exists('NewCityShortcodes')) {
// Set value for `newcity_shortcodes_options` only if it does not exist yet
function set_nc_shortcode_options() {
$options = array(
'enabled_shortcodes' => array(
'custom_blockquote',
'local_script',
'inline_media',
)
);
if ( ! get_option('newcity_shortcodes_options', false) ) {
add_option('newcity_shortcodes_options', $options, '', 'yes');
}
}
// Check if you need to set the enabled shortcodes each time a page loads
add_action('init', 'set_nc_shortcode_option');
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.