从wordpress获取帖子时,在模式中打开自定义链接

从wordpress获取帖子时,在模式中打开自定义链接,wordpress,twitter-bootstrap,Wordpress,Twitter Bootstrap,我试图实现的是在wordpress页面中创建一个带有引导的网格,并将30篇文章显示为缩略图。通过单击缩略图,将显示一个模式框,其中图像为全尺寸 我现在正在做的是,模态弹出,但每次都显示相同的图像。我试图在标签中设置href值,该标签将在模式中显示文章的内容 <?php get_header(); ?> <div id="content" class="clearfix"> <div id="main" class="clearfi

我试图实现的是在wordpress页面中创建一个带有引导的网格,并将30篇文章显示为缩略图。通过单击缩略图,将显示一个模式框,其中图像为全尺寸

我现在正在做的是,模态弹出,但每次都显示相同的图像。我试图在标签中设置href值,该标签将在模式中显示文章的内容

    <?php get_header(); ?>


    <div id="content" class="clearfix">
        <div id="main" class="clearfix" role="main">
            <?php $counter = 0; ?>
             <div class="row-fluid">
            <?php if (have_posts()) : while (have_posts()) : the_post();?>
                <?php if ($counter < 4): ?>
                    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix thumbnail-post span3'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
                        <header>
                            <a href="#myModal" data-toggle="modal" >
                                    <?php the_post_thumbnail( 'graphix-thumbnail' ); ?>
                                    <?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?>
                            </a>
                            <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">                                
                                <div class='modal-body'>
                                    <img src="<?php echo $url; ?>" />
                                </div>
                            </div>
                            <div class="page-header"><h3 itemprop="headline"><?php the_title(); ?></h3></div>
                        </header> <!-- end article header -->

                        <section class="post_content clearfix">
                            <?php the_content(); ?>
                        </section>
                    </article> <!-- end article -->
                <?php $counter +=1; ?>
                <?php else: ?>
                    </div>
                    <?php $counter = 0; ?>
                    <div class="row-fluid">
                <?php endif; ?>



            <?php endwhile; ?>          
            <?php else : ?>
            </div>
            <?php endif; ?>

        </div> <!-- end #main -->    
    </div> <!-- end #content -->

<?php get_footer(); ?>

" />

请参见问题。使用jQuery将数据传递给模式非常容易。

我的错误在于模式的标识符相同,id必须是唯一的。因此我将模式的id更改为“#myModal-”,并且每个模式都有自己的唯一id