WordPress Posts POPUP
-
I need to get a content of the post in a dialog box by clicking on its feature image.
<html>
<head>
<meta charset=”utf-8″>
<title>jQuery UI Dialog – Animation</title>
<link rel=”stylesheet” href=”//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css”>
<script src=”//code.jquery.com/jquery-1.9.1.js”></script>
<script src=”//code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
<link rel=”stylesheet” href=”/resources/demos/style.css”></head>
</html>
<?php
$args = array(
‘post_type’ => ‘post’,
‘posts_per_page’ => 3,
‘order’ => ‘asc’
);
$query = new WP_Query($args);if ( $query->have_posts() )
{
while ( $query->have_posts() )
{
$query->the_post();
?>
<?php
if ( has_post_thumbnail() )
{
?>
<?php $postid = get_the_ID(); ?><script>
$(function() {$( “#dialog” ).dialog({
autoOpen: false,
width: 600,
height:500,
show: {
effect: “blind”,
duration: 1000
},
hide: {
effect: “explode”,
duration: 1000
}
});$( “#opener<?php echo $postid?>” ).click(function() {
$( “#dialog” ).dialog( “open” );
});
});
</script><div style=”float:left;margin-left:3%;margin-bottom:3%;”>
” href=”#”>
<?php the_post_thumbnail(array(150,150)); ?>
</div>
<div id=”dialog”>
<?php the_content(); ?>
</div>
<?php
}
}
} ?>
- The topic ‘WordPress Posts POPUP’ is closed to new replies.