• Hey guys,
    I have setup a options panel but i am struggling with the correct way to implement some of the features!

    I want to modify the css, i am assuming i must do this by adding in the css to my functions.php file? i am using wordpress theme so i want to try and keep all the files in the custom folders so users can upgrade easily.

    Is this the best way to do it?

    Thanks guys
    Alex

Viewing 1 replies (of 1 total)
  • Yes. Register and enqueue your theme options .css file in your theme options script and add then to admin_init and admin_print_styles

    // Load theme options stylesheet
    function add_theme_options_style() {
    	$css_file = get_template_directory() . '/library/theme-options.css';
    	$css_url = get_template_directory_uri() . '/library/theme-options.css';
    	if ( file_exists($css_file) ) {
    		wp_register_style('theme_options_style', $css_url, '', '', 'screen');
    	}
    }
    function enqueue_theme_options_style() {
    	wp_enqueue_style('theme_options_style');
    }
    add_action('admin_init', 'add_theme_options_style');
    add_action('admin_print_styles', 'enqueue_theme_options_style');
Viewing 1 replies (of 1 total)

The topic ‘Creating wordpress options panel! Putting code in to theme’ is closed to new replies.