Different Front page for Mobile

Switching the actual template file could work in the same way as above using get_template_part(). For example… <?php if ( wp_is_mobile() ) { // If it is a mobile device get_template_part( ‘mobile-front’, ‘page’ ); } else { // If it is not a mobile device get_template_part( ‘desktop-front’, ‘page’ ); } // end wp_is_mobile() To take … Read more

How to check False booleans when using get_option?

You can set a default value for when the option does not exist. This way you can check to see if the returned value is false, or if it doesn’t exist at all: $value = get_option( ‘my_option’, $default_value ); if( $value == $default_value ) { // Option does not exist } elseif ( $value == … Read more

Settings API validation callback

If you have an options page (which should be inside one form), then all data is sent from that form, regardless of whether or not the option has been changed. The array received for validation is the data received from (your part of) the form. If the data is ’empty’ it is because the data … Read more

Testing for addon plugin activated

There is the function is_plugin_active() which can be used easily for this check, but what if the user decides to change the folder name of the plugin? Simply put, you’re doing it wrong. If you’re making extensions for a plugin, then you should provide hooks in the “parent” plugin for those addons to hook into … Read more

help using get_option

Remember you need the get_option parameter in quotes, like this: $option = get_option(‘paradiso_category_fields_option’); and to get the img url out of that database option you presented it would be: echo $cat_image[7][‘image’];

How to create color scheme for my custom theme?

Here is the answer to my question… Add this to your functions.php // Options Page Functions function themeoptions_admin_menu() { // here’s where we add our theme options page link to the dashboard sidebar add_theme_page(“Theme Color”, “Theme Color”, ‘edit_themes’, basename(__FILE__), ‘themeoptions_page’); } function themeoptions_page() { // here’s the main function that will generate our options page … Read more

Transients API conditional

You could use a sanitized version of the URL as part of the name of the transient … but transient names are limited in their size. I would store the transient as an array with the URL and the HTML as two parts. Then check if the URL is the same. If it is, use … Read more

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