get_option array value defaults and best practices

First question: Is this a good practice? Based on the type of value you are saving, array as settings value is definitely good practice. How can I do this for a value within an array ex. get_option(‘header’)[‘header_logo’][‘image’]? If you believe option value for header might be empty or not saved, you can use this – … Read more

What are Attributes used for in a WordPress Multisite?

The “Deleted”, “Spam” and “Archived” attributes If you checked “Deleted”, “Spam” or “Archived”, the site would no longer be accessible to the public and all users except super admins, and the only thing non super admins would see is a notice saying: “This site is no longer available.” if the “Deleted” attribute is checked. “This … Read more

update a value in wp_options [closed]

This is escaped JSON. Formatted nicely, it looks like this: [ { “title”: “Brand Primary”, “value”: “#2185D0”, “_id”: “627a0637cf178d93e50be224cc07cd6e” }, { “title”: “Brand Secondary”, “value”: “transparent”, “_id”: “017280d9ec94a585c2de0bee8f49d8fb” }, { “title”: “Typo normal”, “value”: “#383838”, “_id”: “ff77119a11466c8d7a0efd612109fe6a” }, { “title”: “Typo on Brand Base”, “value”: “#383838”, “_id”: “8a3c1eebb8067b37fc47fc505f44b8b4” }, { “value”: “rgb(255, 255, 255)”, “title”: … Read more

Can’t delete unwanted favicon

The default favicon location on your server gives a 404: http://www.steve.doig.com.au/favicon.ico Your blogs homepage source-code related to linking to another location is: <link rel=”icon” type=”image/png” href=”http://www.steve.doig.com.au/wordpress/wp-content/themes/grid-focus-public-10/images/favicon.ico”> Note: The file suffix is .ico which normally stands for an Microsoft Icon file. But names are not interesting for that. The type=”image/png” is correct here, it’s a PNG … Read more

Where is the submitted $_POST array stored after an option page submission?

You only need one callback function, as defined in your call to register_setting() (Codex ref.): register_setting( $option_group, $option_name, $sanitize_callback ); Thus, all options are contained in an array, in a single database entry, $option_name. Then, the callback function is passed the $input variable that holds all of the form-submitted data, the function manipulates/sanitizes those data, … Read more

Working with an Array inside Your Theme Options Array – Multiple Values

Assuming this array for example usage: $options = array( “name” => __(‘Font’,’mytheme’), “desc” => __(‘Change the font face)’,’mytheme’), “id” => “mytheme_font”, “std” => array(‘size’ => ’10px’, ‘face’ => ‘Arial’, ‘color’ => ‘#000000’), “type” => “text”, ); For question 1, to reference nested arrays, just reference them directly. echo $options[‘std’][‘size’]; In the form input, if using … Read more

is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’

Here’s something I wrote because my clients were using very high quality pngs, when they could be more lossy jpgs for web. Note this still preserves the original image, only changes the thumbnails. Add this to your functions.php <?php //Force PNG Thumbnails into JPGs add_filter(‘wp_generate_attachment_metadata’,’force_png_to_jpg’); function force_png_to_jpg($image_data) { $sizes = array(‘thumbnail’,’medium’,’large’); $upload_dir = wp_upload_dir(); $file … Read more

Putting my site live

This question has been asked many many times before. Here’s the Codex: http://codex.wordpress.org/Changing_The_Site_URL The easiest thing to do is add a couple of lines to your wp-config.php define(‘WP_HOME’,’http://example.com’); define(‘WP_SITEURL’,’http://example.com’);

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