我试图用我自己的模板(Im making it)创建一个自定义wordpress网站,在主页上,我按类别、标签和摘录显示我的所有帖子,所有这些都可以,但我试图使页面成为一个单独的页面,因此,我试图在一个模式窗口中显示每个帖子(仅使用css3和html5,模式本身效果很好)。问题是,当我将每个帖子的内容放在模式中时,它只显示列出的第一篇帖子的内容,有人能帮我吗?
*代码:
<?php get_header(); ?>
<!--Pre Loading container-->
<div class="contenedor" id="contenido">
<div class="loading anime2" id="loading1">
<img src="<?php bloginfo(\'template_url\');?>/img/logo1.svg" alt="" class="loading-logo">
</div>
<?php
// get all the categories from the database
$cats = get_categories();
// loop through the categries
foreach ($cats as $cat) {
// setup the cateogory ID
$cat_id= $cat->term_id;
// Make a header for the cateogry
echo "<div class=\'panel\'> <div class=\'cuerpo\'> <a class=\'encavezado\'>".$cat->name."</a><div class=\'cuerpoprin\'><div class=\'cuerpoprin2\'>";
// create a custom wordpress query
query_posts("cat=$cat_id&posts_per_page=100");
//Some Variables
$contador=0;
$Audio = "Audio";
$Video = "Video";
$Texto = "Texto";
// start the wordpress loop!
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php $Titulo = get_the_title(the_post());?>
<?php $excerpt = "".get_the_excerpt(); ?>
<a href="#open-modal" style="text-decoration: none;">
<div class=\'programas\' style=\'left: <?php echo $contador*350; $contador=$contador+1 ?>px;\' >
<?php
// Must be inside a loop.
//Thumbnail filter, displays thumbnail by category or by the thumbnail uploaded
if ( has_post_thumbnail() ) {
echo \'<img src="\'.get_the_post_thumbnail_url().\'" alt="" class="programa">\';
}else{
echo \'<img src="\';
echo bloginfo(\'template_url\').\'/img/programas/programa\'.$cat->name.\'.jpg" alt="" class="programa">\';
}
?>
<!--SubImage Refrence as a watermark of the category each post got this image puted in front of each post of th ecategory it belongs-->
<img src="<?php bloginfo(\'template_url\');?>/img/programas/logos/logo-programa<?php echo $cat->name ?>.svg" alt="" class="logo-programa">
<!--Subttitle given by the excrept showed in the post display-->
<p class="act"> <?php echo $excerpt;$examplePost = get_post();
echo $examplePost->ID; ?> </p>
<!--Showing an image for the tag of the post-->
<div class="programa-etiqueta">
<img src="<?php bloginfo(\'template_url\');?>/img/icon/icon-recurso<?php $posttags = get_the_tags();if ($posttags) {foreach($posttags as $tag) {if ($tag->name == $Audio) {echo "1"; }elseif ($tag->name == $Video) {echo "2"; }elseif ($tag->name == $Texto) {echo "3";}}}?>.svg" alt="" class="media-imagen">
</div>
</div>
<!--HEEEEEEEERE IS THE PROBLEEEEEEEEEEEM (Start of the modal)-->
<div id="open-modal" class="modal-window">
<div>
<a href="#modal-close" title="Close" class="modal-close">Close</a>
<!--Here I tried to display post title, in diferent ways, by using local Variables, by showing with "get_the_title()" function of wordpress passing by parameter the id and the object post , tried to use "the_title()" because im inside of the wordpress loop, but nothing seems to work, it shows only the first post listed info, in every post modal :( (currently is trying to show the Post ID, as before only shows first post listed ID-->
<h1><?php $examplePost = get_post();
echo $examplePost->ID; ?></h1>
<div>
</iframe>
</div>
</div>
</div>
<?php endwhile; endif; // done our wordpress loop. Will start again for each category ?>
</div>
</div>
</div>
</div>
<?php } // done the foreach statement ?>
</div>