Enqueue Javascript Correctly for 3.5

Never de-register core-bundled scripts in the WP-Admin. You shouldn’t do it on the front end, either, unless you really, really know what you’re doing. But especially in the WP-Admin, just use the core-bundled scripts. Also, when you use core-bundled jQuery UI, WordPress already knows that jQuery is a dependency. Just change the first callback to … Read more

Copying theme from Localhost to Live does not copy all theme settings with it?

Since I found this script, I have used it for every single move I make from Localhost to Live or vice versa. It’s incredibly simple to use and has worked every time. https://github.com/interconnectit/Search-Replace-DB (Review: https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ ) From their site: You must use a safe search and replace method that preserves the integrity of the serialized … Read more

Save Theme Options (options.php) From The Frontend

You Do Not want to post /wp-admin/options.php from the front end , thats a bad idea and can cause problems. To updated Options from the frontend simply use update_option() and make sure you verify correctly. here is an example using your code with minor fixes: <?php if (isset($_POST[‘stylesheet’]) && isset($_POST[‘action’]) && $_POST[‘action’] == “update_theme”){ if … Read more

Serialized settings in rest api

JSON Schema It’s supported if you explicitly register the object JSON schema as: $args = array( ‘show_in_rest’ => array( ‘schema’ => array( ‘type’ => ‘object’, ‘properties’ => array( ‘post’ => array( ‘type’ => ‘string’, ), ‘blog’ => array( ‘type’ => ‘string’, ), ) ), ), ); register_setting( ‘default_sidebars’, ‘default_sidebars’, $args ); Resulting in the following … Read more

Updating wp_options with an array on save_post results in duplicated entries

I had something similar going on when I tried to use the wp_editor() function while inside a custom metabox. It was wanting to save multiple times. Take a look at this. // SAVE Metabox for admin response add_action(‘post_updated’, ‘display_jwl_wp_etickets_response_meta_box_save’); function display_jwl_wp_etickets_response_meta_box_save( $post_id ){ if( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if( !isset( $_POST[‘jwl_wp_etickets_editor_box_nonce_check’] ) … Read more

Define WordPress image size in img tag

How about PHP Function getimagesize() <? $sImageurl = of_get_option(‘slideshow_1’); list($iWidthinpx, $iHeightinpx) = getimagesize($sImageurl); echo ‘<img src=”‘ . $sImageurl . ‘” width=”‘ . $iWidthinpx. ‘” height=”‘ . $iHeightinpx. ‘” alt=”#”/>’; ?> or if you know the attachment id instead of the attachment url you could use <? $aImagedata = wp_get_attachment_image_src($iAttachmentid, ‘my-image-size’, false); list($sImageurl, $iWidthinpx, $iHeightinpx) = … Read more

How to Save Different Settings Options Using Settings API and/or the Theme Optimizer

I did something similar as an import/export facility. Essentially I created a Theme Options Import/Export page in the dashboard, then just export the theme options (using get_option()) to a file as a JSON encoded string and post it for the user to download. Then give them an upload facility the imports said file (using update_option()). … Read more

Why isn’t get_option array contents displaying?

Let’s look at your code. Your first code block is treating an array like an object so your second attempt is closer to accurate: $the_contents=get_option(‘slider_contents’); // var_dump($the_content); foreach ($the_contents as $content) { $content1=stripslashes($content[‘content’]); $content2=stripslashes($content[‘content2’]); Assuming you did what I suggested and placed the var_dump where I have in that code block, then what is happening … Read more

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