我在这里解释我的情况:
在我的主页上,我有一个正在显示的帖子列表。
我有一个类似模式框的代码来分享这篇文章。基本上,每个帖子上都有一个按钮共享。单击后,将显示一个框,其中包含指向FB、twitter等的共享链接。如下所示:http://www.joe.ie/ (包括出现的Fadein背景)。
问题是,它没有显示好的帖子共享。。。但他们都是。我的意思是,当我点击A帖的共享按钮时,它应该会显示A帖的标题。
现在,我点击了帖子A、B或C的共享按钮。它显示了与所有帖子“A”、“B”、“C”等相关的框。
为了解决这个问题,我添加了一个post\\u ID类。然而,它并没有改变任何东西——我想我需要在jquery中添加它——但如何?下面是我的jquery
<script type="text/javascript">
$(document).ready(function() {
$(\'a.share2\').click(function() {
$(.icons2\').fadeIn(\'500\');
$(\'.bg2\').fadeIn(\'500\');
$(\'a.share-close\').fadeIn(\'500\');
$(\'#nav-wrapper\').css(\'z-index\',\'-1\');
});
});
</script>
以及我的循环,其中我将post\\u id作为一个类调用:<div id="top-story-left">
<?php if(get_option(\'mvp_featured_left\') == \'Select a category:\') { ?>
<?php } else { ?>
<span class="top-header-contain"><h3><?php echo get_option(\'mvp_featured_left\'); ?></h3></span>
<ul class="top-stories">
<?php if (!empty($do_not_duplicate)) { $current_category = get_option(\'mvp_featured_left\');
$category_id = get_cat_ID($current_category); $recent = new WP_Query(array( \'cat\' => $category_id, \'post__not_in\' => $do_not_duplicate,
\'posts_per_page\' => \'2\' )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; if (isset($do_not_duplicate)) { ?>
<li class="post-<?php the_ID(); ?>">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php if ( (function_exists(\'has_post_thumbnail\')) && (has_post_thumbnail()) ) { ?>
<div class="top-story-image">
<?php the_post_thumbnail(\'small-thumb\'); ?>
<?php if(get_post_meta($post->ID, "mvp_video_embed", true)): ?>
<div class="video-button">
<img src="<?php echo get_template_directory_uri(); ?>/images/video-but.png" alt="<?php the_title(); ?>" />
</div><!--video-button-->
<?php endif; ?>
</div><!--top-story-image-->
<?php } ?> <span class="time2" style=" font-size: 12px;
padding-bottom: 20px;
position: relative;
bottom: 6px;
color: #2E5894;font-family: \'Open Sans Condensed\', serif !important;display:block;width:50px;margin:0 auto;padding-bottom:0px
}"><?php echo time_ago(); ?></span>
<h2><?php the_title(); ?></h2>
</a>
<div class="sm-middle">
<span class="social-middle" style="top:-5px;position:relative">
<div class="share-trigger" style="margin-bottom:50px">
<a class="share2" href="javascript:void(0)"><img width="25" height="25" style="float:left" src="http://mysite.co.uk/wp-content/uploads/2015/06/share.png">
<p style="top:5px;position:relative"> SHARE</p></a></div>
<div class="bg2" style="display:none">
<div style="display:none" class="icons2">
<span class="header-share-box"><p style="padding:10px;text-transform:uppercase">share this article<a class="share-close"
style="color:white;text-decoration:none;position:relative;display:none;z-index:999;float:right;top:-8px" href="javascript:void(0)">
<img width="30" height="30" src="http://mysite.co.uk/wp-content/uploads/2015/06/close.png" /> </a></p>
</span><br/>
<p style="color:black;font-weight:bold">Share the following article: "<?php the_title(); ?>" </p>
<a style="width: 22px;
left: 0px;
position: relative;top:10px" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>&text=<?php the_title(); ?>">
<img width="50" heigh="50" src="http://mysite.co.uk/wp-content/uploads/2015/06/fb1.png" alt="Facebook" /></a>
<a style=" width: 22px;
left: 10px;
position: relative;top:10px" href="#" onclick="window.open(\'http://twitter.com/share?text=<?php the_title(); ?> -&url=<?php the_permalink() ?>\', \'twitterShare\', \'width=626,height=436\'); return false;" title="Tweet This Post">
<img width="50" heigh="50" src="http://mysite.co.uk/wp-content/uploads/2015/06/twitter.png" alt="Twitter" /></a>
<a style="width: 22px;
left: 20px;
position: relative;top:10px" href="mailto:mymail@mail.com?subject=I woud like to share with you this article from X: <?php the_title(); ?>&body=I saw this article on X, and thought it may interrest you from X: <?php the_permalink() ?> ">
<img width="50" heigh="50" src="http://mysite.co.uk/wp-content/uploads/2015/06/mail.png" alt="Mail" /></a>
</span></div></div>
</div>
</li>
<?php } endwhile; } ?>
</ul>
<?php } ?>
</div><!--top-story-left-->
任何名人都会非常棒,至少要知道我是否走上了正确的道路:):):)谢谢大家:)