Hallo zusammen,
ich versuche gerade das erste mal jquery-Funktionalitäten im Template zu nutzen. Leider kriege ich es noch nicht so hin, wie es (glaube ich) eigentlich funktionieren soll:
Wenn ich einfach den Beispiel-Code von der Jquery-Dokumentation in die post.php oben einfüge funktioniert es:
PHP
<?php get_header(); ?>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script><?php wp_enqueue_script( 'jquery' ) ?>
<script>
$(function() {
$( "#dialog-modal" ).dialog({
height: 140,
modal: true
});
});
</script>
<div id="dialog-modal" title="Basic modal dialog">
<p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p>
</div>
<div id="content">
...
Alles anzeigen
Nun habe ich aber gelesen, dass man das so ja eigentlich nicht machen soll, da wp jquery schon mitbringt. Also habe ich es so probiert:
PHP
<?php get_header(); ?>
<?php wp_enqueue_script( 'jquery' ); ?>
<script>
$(function() {
$( "#dialog-modal" ).dialog({
height: 140,
modal: true
});
});
</script>
<div id="dialog-modal" title="Basic modal dialog">
<p>Adding the modal overlay screen makes the dialog look more prominent because it dims out the page content.</p>
</div>
<div id="content">
...
Alles anzeigen
Dann passiert aber nichts mehr :) Wahrscheinlich habe ich die Nutzung einfach falsch verstanden. Kann mir jemand sagen, wie man das richtig machen sollte?
BG Doena