Final Fantasy Online

Home Articles Games Forums Shop
You are not logged in. Log In or Sign Up.
Browse Online Now Directory New Posts Achievements Help/FAQ
Search


Final Fantasy Online Forums  >  Community Discussion  >  The Dork Squad

Another web programming help thread





0
 08.28.2012 5:32am
Thread Creator

scnix
scnix.com



Hey guys,
I have a wordpress site that I'm trying to design. Here's what I'm trying to do.

  1. Click on a link opens an overlay with a grid of wordpress posts
  2. Click on a post from the grid closes the first overlay and opens another overlay
  3. The 2nd overlay displays the single post that I just click from the grid overlay
  4. 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! 




 Jump to Post












Jump to

Go




© Copyright 2024 Final Fantasy Online, All Rights Reserved
Home  |  Articles  |  Games  |  Forums  |  Shop  |  Contact Us  |  Terms of Use  |  Privacy Policy
Become a Facebook FanFollow us on Twitter