Writing Mysql and Php code in wordpress Posts

With a stock WordPress install, you cannot insert server side code like PHP directly into a post, only HTML-compatible text. Using the [code][/code] shortcode only outputs what is inside as PRE and CODE elements of HTML, useful for showing code to your readers. In general, it is a bad idea to put code directly into … Read more

Pause plugin option page until all data manipulation is complete

You can only do this by “loading content into all the posts in the blog” asynchronously (in the background). So, move the processing inside a function that you hook on wp_ajax_your_action_tag. Then call this function with javascript by requesting WP to fire “your_action_tag”. There’s a example on the linked page… If you want to display … Read more

Tabbed theme options query about add_settings_section callback function

You only need one register_setting() call. The rest can be handled internally. I wrote a Settings API tutorial that explains how to do so. Without delving too deeply into the code from the tutorial you linked, just based on the screenshot it appears that the Digital Raindrops code bypasses the standard, WordPress core admin UI … Read more

settings api and the data passed in the parameter

You sanitization callback function get passed all the values that correspond with the setting name. When a POST request is made to the options.php file from the page on which your settings resides, WordPress calls your sanitization callback in a way that would resemble this: <?php boj_myplugin_validate_options( $_POST[‘boj_myplugin_options’] ); Notice that the name attribute looks … Read more

WordPress settings API VS Table In Database?

You should use Custom Post Types. No extra table, no missuse of Settings API. Use CPTs with Title field, WYSIWYG/textarea (for caption) & a featured image (for the actual slider image). This way later themes can also make use of it. Just name the CPT “slider”. Here´s a read why sliders & carousels are not … Read more

custom change in front page [closed]

Looking at your site, then looking at the live demo of the theme … and that archive section isn’t hard-coded into the theme by default. This potentially means one of two things: You or someone managing your site added it The archive widget is the “default” widget for some section and you haven’t put anything … Read more

[Multisite]How can I update custom blog option?

As per the Codex on update_blog_option: Switches to the blog id specified, runs update_option() and then restores to the current blog. If $refresh is true then it will refresh the blog details. Not tested, but I think your problem is trying to update elements of the array instead of the whole thing: $the_options = get_blog_option($blog_id, … Read more

Verify Submitted Form Values and Show Warning Messages with Setting API

First add a validation callback to your register_settings: register_setting( ‘settingsapi_optiongroupname’, ‘settingsapi_optionname’,’validation_callback’); then define validation_callback: function validation_callback($input){ //check if all is good //If so then return the wanted value to be saved //If Not then hook your admin notice function and return null to be saved ex: if ($something){ return $input; }else{ add_settings_error(‘unique_identifyer’,esc_attr(‘settings_updated’),__(‘Settings saved.’),’updated’); add_action(‘admin_notices’, ‘print_errors’); … Read more

Cloning add_settings_field() with jQuery

jQuery can only clone what is on the current page or what is loaded over AJAX, so setting something up on the backend and cloning it on the front is not possible. What you can do is create a string and print to the front as a Javascript variable or as a hidden div that … Read more

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