Using wp_parse_args to set up Plugin Default Settings

Try: function eddslider_options_each( $key ) { $edd_slider_options = get_option( ‘eddslider_options’ ); /* Define the array of defaults */ $defaults = array( ‘slider_insert’ => 0, ‘slider_arrows’ => 0, ‘slider_bullets’ => 0, ‘slider_effect’ => ‘fade’, ‘slider_theme’ => ‘default’ ); $edd_slider_options = wp_parse_args( $edd_slider_options, $defaults ); if( isset($edd_slider_options[$key]) ) return $edd_slider_options[$key]; return false; }

WordPress Options Page not working

The problem part is this line: <form method=”post” action=”options.php”> This sends your form to wp-admin/options.php (and I guess you’re not sending the form from this URL). Leave the action value empty like this: <form method=”post” action=””> And your form will send itself to the same page from which it was sent. Then you can save … Read more

How to find what index page a post is on?

There’s no way to do it directly but there’s a way to determine the position of a particular row in a mysql query. You can find out how to do it here- https://stackoverflow.com/questions/3614666/mysql-get-row-position-in-order-by Once you have the position you can divide it with the value from get_option(‘posts_per_page’) to determine the correct page number.

Serialize data for wp options

To store Data use this Code : save the serialize values $title=”Your Title Value”; $message=”Your message HTML..”; $image=”http://www.domain.com/yourimage.jpg”; $notice_data = array(‘title’ => $title, ‘message’ => $message, ‘image’ => $image ); if(get_option(‘notice_data’) === FALSE){ add_option(‘notice_data’, $notice_data ); }else{ update_option(‘notice_data’, $notice_data ); } Now you can get the serialize values and use in your code $notice_data = … Read more

Save wp_editor() content as option

If you just want to get rid of the \ characters in the string that’s returned, you can use PHP’s stripslashes(): $content = stripslashes( $content ); I’d recommend doing this on output rather than on input; WordPress adds the slashes as it sanitizes your data on insert, per update_option()‘s Codex page, The $option (option name) … Read more

Set the active Navigation Menu from a plugin

You can use the wp_nav_menu_args filter ( Codex reference ) to set a theme location to use a specific menu. Example: function test_wp_nav_menu_args( $args=”” ) { // only set menu for the primary navigation menu. if ( $args[‘theme_location’] != ‘primary’ ) { return $args; } // change {main-menu} to be the slug of the menu … Read more

How do i save plugin-specific info?

I would recommend you store it as an option Here is the API: add_option( $option, $value, $deprecated, $autoload ); update_option( $option, $new_value ); get_option( $option, $default ); delete_option( $option ); For your option I would not set autoload to true for performance reasons ( unless you are grabbing this option on every page ). I … Read more

What is _transient_random_seed for?

The wp_rand function mixes up the randomization of random numbers with various means, and in between runs it stores the random seed so as to keep the shuffling going every run. The random_seed transient is where it stores that.

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