$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>CSS not pulling in for jQuery UI dialog|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

CSS not pulling in for jQuery UI dialog

matteradmin9PV0评论

I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page:

wp_enqueue_script('jquery-ui-dialog');

The jquery css (jquery-ui-dialog.css) is under my wp-includes/css directory. I tried adding

wp_enqueue_style('jquery-ui-dialog');

but it not work. Does anybody know the proper way to enable jQuery Dialog.

I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page:

wp_enqueue_script('jquery-ui-dialog');

The jquery css (jquery-ui-dialog.css) is under my wp-includes/css directory. I tried adding

wp_enqueue_style('jquery-ui-dialog');

but it not work. Does anybody know the proper way to enable jQuery Dialog.

Share Improve this question asked Jul 13, 2011 at 17:44 ClutchClutch 1971 silver badge5 bronze badges 2
  • 6 wp_enqueue_style( 'wp-jquery-ui-dialog' ); – Tom Auger Commented Oct 31, 2011 at 17:13
  • 3 Also make sure that you add the 'wp-dialog' class to the dialog itself, so it can take advantage of those styles. They're pretty ugly though. Might be better off using the jQuery UI themed styles anyway. – Tom Auger Commented Oct 31, 2011 at 17:18
Add a comment  | 

2 Answers 2

Reset to default 8

There is no jquery-ui-dialog style defined in WordPress Out of the box, you need to ue the stylesheets manually, when i needed to enqueue the jQuery-UI style i pulled it from google api CDN

wp_enqueue_style('jquery-style', 'http://ajax.googleapis/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); 

but you can enqueue a local copy if you want like this:

wp_enqueue_style( 'myStylesheet', WP_PLUGIN_URL . '/path/stylesheet.css' );

You can include the jquery-ui-dialog style in frontend using:

wp_enqueue_style( 'wp-jquery-ui-dialog' );

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far