How Can I Register Menus and Widgets Conditionally Based on Theme Options/Settings?

Below is the code you need. Your issue could be that you’re not first setting up the variable $display_options to contain your options, or that you not asking if the option is set. add_action(‘widgets_init’, ‘arphabet_widgets_init’); function arphabet_widgets_init() { $options = get_option(‘muffin_options’); if(isset($display_options[‘header_layout’]) && $display_options[‘header_layout’] == ‘1’) { register_widget(‘arphabet_widget_1’); } if(isset($display_options[‘header_layout’]) && $display_options[‘header_layout’] == ‘1’) { … Read more

How do I use add_control to offer a list of all pages in the customiser?

To add a Customiser control for selecting a page from a dropdown you just need to set the type argument to dropdown-pages: $wp_customize->add_control( array( ‘type’ => ‘dropdown-pages’, ‘section’ => ‘my_custom_section’, ‘label’ => __( ‘Pick a page, bub’ ), ) ); This will give you a control that’s a <select> dropdown with a list of pages … Read more

Problem with query_posts for a custom taxonomy in theme options

I see three things. if ( function_exists( ‘of_get_option’ ) ) : query_posts( ‘cat=” . $homepage_feature = of_get_option( “homepage_feature’ ) . ‘&posts_per_page=3’ ); You have a syntax error. There is no endif;. Maybe that is a typo, but maybe not. If you are trying to write a one-line if, remove the colon. Your title states “custom … Read more

PHP stylesheet cannot use standard WP functions

If you’re linking to a file, it’s opened as a new file. So unless you explicitly include wp_load.php or something within that styles file, WordPress is not available. Loading WP all over again in one page load seems like complete overkill to me. Why don’t you just include your style file as an inline stylesheet, … Read more

Using theme options to change link colours

To make theme options for css, you include the css in the header. on wp_head… For instance, I have set up various options in my admin menu in an array. ‘name’ => __( ‘Custom CSS’, ‘voodoo_lion’ ), “desc” => __( ‘Want to add any custom CSS code? Put in here, and the rest is taken … Read more

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