How to understand a specific bit of WordPress syntax

That’s a Shortcode. It may be possible to find the function that renders that shortcode and copy/paste it into your own plugin, making it theme-independent, however, how easy that will be to do depends on how the shortcode works- if it depends on additional php functions, JavaScript, and CSS embedded within the theme.

How to create dependent field in Customizer?

You can get and check the value of your theme mod as you normally do anywhere. This code is tested and working (the code inside cyb_customizer() is exactly the code you posted in the question, only added add_section part): function flag_is_custom_excerpt_enabled(){ $blueplanet_options = get_theme_mod( ‘blueplanet_options’); if( empty( $blueplanet_options[‘theme_enable_custom_excerpt’] ) ) { return false; } return … Read more

max_input_vars: how many am I using?

max_input_vars is the limit on the total number of GET, POST, and COOKIE vars. To determine how many there are you can just count them. Here’s a quick example in a WordPress context: function wpd_admin_error_notice() { echo ‘This request contained ‘ . count( $_POST ) . ‘ POST vars, ‘ . count( $_GET ) . … Read more

Displaying theme options in css

Although @Jevuska did solve my issue, I have found a much easier solution to adding dynamic CSS from my theme options page. Here we go! Add this to functions.php add_action(‘wp_head’, ‘my_custom_css’); function my_custom_css(){ require_once( get_template_directory() . ‘/css/theme-styles.php’ ); } Now you can treat theme-styles.php as a normal CSS stylesheet <style type=”text/css”> a { color: <?php … Read more

How to set different settings for a mobile theme?

Just wrap you code up in a conditional: if ( $GLOBALS[‘is_iphone’] ) { // do funky stuff for mini screens } global $is_iphone; will trigger TRUE for all mobile devices incl. tablets. Edit for WP 3.4+ Now there’s wp_is_mobile() to make checks for User-Agent. It’s basically a wrapper for $is_iphone and does the same.

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