scnix
scnix.com
|
|
Hey guys,
I have a wordpress site that I'm trying to design. Here's what I'm trying to do.
- Click on a link opens an overlay with a grid of wordpress posts
- Click on a post from the grid closes the first overlay and opens another overlay
- The 2nd overlay displays the single post that I just click from the grid overlay
- At the moment, 1 and 2 are working fine. The transition from 2 to 3 works fine too. However, on 3, wordpress displays all posts and refuses to only display the specific post that I just clicked.
Below is the code in wordpress' footer.php that has all the overlays and script.
----------------------------------
<div id="the_grid_container" class="hide-div popup-content" popup="yes">
<?php $jquery_value = $_POST['grid_target'];?>
<?php query_posts( 'p='.$jquery_value.'' ); ?>
<?php echo $jquery_value; ?>
<?php get_template_part('popup_content'); ?></div>
<script type="text/javascript">
$(document).ready(function() {
$('a[trigger="close_grid"]').click(function(){
var $grid_post = $(this).attr('grid_target');
$('#mask').fadeOut(300);
$('#mask').delay(300).fadeIn(300);
$('#the_grid_container').delay(300).fadeIn(300);
$.post("<?php bloginfo( 'template_directory' ); ?>/footer.php", { grid_target: $grid_post } ); });});
</script>
--------------------
The script is calling specific DIV elements with custom attributes.Here's the code for the_grid.php
--------------------
<div id ="the-grid">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$thumb_img = get_field('thumb_img', $post->ID);
$price = get_field('price', $post->ID);
$this_post = $post->ID; ?>
<a href="#" title="<?php the_title();?>" trigger="close_grid" grid_target="<?php echo $this_post;?>">
<div id="grid-box">
<img src="<?php echo $thumb_img; ?>" title="<?php the_title();?>" alt="<?php the_title();?>"/>
<h2><?php the_title();?></h2>
<?php echo $price; ?>
</div> </a>
<?php
endwhile;
endif;
wp_reset_query();
?>
</div>
--------------------
I'm using a plugin called "Advance Custom Fields" for my meta tags. That's where the "get_field('price', $post->ID);" comes from.You can check out the full site @ www.theoldfox.net
Any help would be greatly appreciated!
|