Localise settings section headline

Localize the headings in your initial array: $sections = array( ‘notifcations’ => __( ‘Notifications’, ‘your_text_domain’ ), ‘updates’ => __( ‘Updates’, ‘your_text_domain’ ) ); foreach ($sections as $section => $header ) { add_settings_section( $section .’_section’, $header, array( $this, ‘disable_callback_warnings’ ), ‘sgnc’ ); }

Page Options Saving But Not Updating In Backend

If the page is manually refreshed then the right content shows up, it’s so weird! I am pretty sure this is the problem, and its not that weird. If you update with AJAX (in your case with jQuery/Javascript) the generated page– the page in the browser– is not going to reflect any changes unless your … Read more

How to include stylesheet in custom admin using parent_slug

Don’t confuse menu structure with page/URL structure. Each one of your pages may have a different hook. Do this: function my_enqueue($hook) { echo $hook; } add_action( ‘admin_enqueue_scripts’, ‘my_enqueue’ ); Load your pages and write down the hook names. There may be other ways to do this too, like the admin-print-scripts-$hook_suffix hooks. Look in wp-admin/admin-header.php to … Read more

Theme Option select values

There’re several things to note: get_settings() is deprecated and get_option() should be used instead WordPress comes with a function named select() that takes three arguments: Saved value, looped value, echo You’re better off saving your key, than the HTML capable “title” element in your options. It’s much safer to save in the DB an easier … Read more

Creating on-page options for Custom Post Type

What you want is a custom meta box. Searching this site will give you plenty of examples as well, but here’s a brief run down. You hook into add_meta_boxes and call, appropriately, add_meta_box. <?php add_action(‘add_meta_boxes’, ‘wpse87567_add_box’); function wpse87567_add_box($post_type) { // $post_type the “page” on which the `add_meta_boxes` action is being fired // It could be … Read more

How to access a variable on all page?

Generally, you cannot access local variables in a function from outside the function, so this… function func() { $var = 2; } $var = 1; func(); echo $var; would result in “1”. To make a global variable, you can do this to make $option available outside functions.php: function func() { global $option; $option = get_option( … Read more

Custom Theme Fields in Settings Menu – apply filters to one of those fields?

You can create a custom filter using filter functions of Plugin API. I have changed you code as following to create and use custom filter. function add_gcf_interface() { add_options_page(‘Other’, ‘Other’, ‘8’, ‘functions’, ‘otherGlobalOptions’); } function otherGlobalOptions() { ?> <div class=”wrap”> <h2>Sonstiges</h2> <form method=”post” action=”options.php”> <?php wp_nonce_field(‘update-options’) ?> <p><strong>Welcome Message</strong><br /> <textarea name=”welcomemessage” cols=”100%” rows=”7″><?php echo … Read more

accessing wordpress serialized data outside wp

Use PHP’s unserialize function: <?php $data=”a:2:{i:0;s:12:”Sample array”;i:1;a:2:{i:0;s:5:”Apple”;i:1;s:6:”Orange”;}}”; $unserialized = unserialize($data); echo ‘<pre>’; print_r($unserialized); echo ‘</pre>’; ?> Result: Array ( [0] => Sample array [1] => Array ( [0] => Apple [1] => Orange ) ) Got the sample data over at unserialize.com, a handy little site if you want to quickly check what’s inside that … Read more

wp_dropdown_categories initial value

you can set the initial value of categories drop down by passing category id to selected parameter of wp_dropdown_categories function as shown in following code : wp_dropdown_categories( array( ‘child_of’ => 20, ‘selected’ => get_cat_ID( ‘Bedrooms’ ) ) ); For more information on this visit this code page.

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