Settings Fields not showing up in Submenu Page

The the code below: if(!class_exists(‘ce_add_scripts’)){ class ce_add_scripts{ function __construct(){ add_action(‘admin_init’, array(&$this,’ceas_admin_init’)); add_action(‘admin_menu’, array(&$this,’ceas_admin_menu’)); add_action(‘wp_head’, array(&$this,’ceas_wp_head’)); add_action(‘wp_footer’, array(&$this,’ceas_wp_footer’)); } function ceas_admin_menu(){ add_submenu_page( ‘tools.php’, ‘CE Add Scripts’, ‘CE Add Scripts’, ‘update_plugins’, ‘ceas_menu_page’, array(&$this,’ceas_page_callback’) ); } function ceas_admin_init(){ $args= array( ‘type’=>’string’, ‘default’=>NULL,); register_setting( ‘ceas_options’, ‘ceas_main_settings’, $args); add_settings_section( ‘ceas_options_section’, ‘Insert Scripts to Head or Footer’, array(&$this,’ceas_section_display’), ‘ceas_menu_page’); add_settings_field( ‘ceas_options_field_0’, … Read more

How do I render content from a wp_editor in a plugin setting field?

the_content filter can be used to filter the content after it is retrieved from the database and before it is printed to the screen. The Core filters on the_content are: add_filter( ‘the_content’, ‘wptexturize’ ); add_filter( ‘the_content’, ‘convert_smilies’ ); add_filter( ‘the_content’, ‘convert_chars’ ); add_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘shortcode_unautop’ ); add_filter( ‘the_content’, ‘prepend_attachment’ ); Reference … Read more

Settings page – can’t change checkbox to unchecked

I’ve done some debugging, it came out that this line caused wrong behavior: $settings = wp_parse_args( $settings, $defaults ); I wondered why it’s after this line which supposedly does the same: $settings = get_option( ‘acau_settings’, $defaults ); These 2 lines one after another were part of code from a wiser man, so I thought that … Read more

Multiple plugins linked to same settings page

Perhaps you could create a dedicated settings plugin, which you would use to add single settings page and register separate section and setting for each token/url/etc. As the settings are saved to the database you can get them with get_option( ‘setting_name’ ) in any other plugin whenever you need.

How to call a WP Class inside my theme

You should be able to do something like this: $wp_customize = new \WP_Customize_Manager(); …since, as I understand it, WordPress core puts all its classes, functions, etc. in the global namespace. Edit It appears that $wp_customize may be a bad example, as it’s a global variable (so, in your theme, all you should need to do … Read more

Assign value to custom checkbox using get_option()

You can use the checked function for this. https://codex.wordpress.org/Function_Reference/checked The value attribute just indicates the value to be saved if the box is checked. eg. <input type=”checkbox” class=”custom-control-input” name=”my-option” id=”customSwitch1″ value=”1″ <?php checked( ‘1’, get_option(‘my-option’), true ); ?>>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)