• Hi,
    I’ve created my own slider with CSS and javascript. My problem is trying to figure out why the title’s of my posts aren’t hyperlinking. Is there something in this code that makes this so?

    Template:

    <div id="container">
    		<div id="content">
    <div id="pee">
                <?php //WordPress loop for custom post type
     $my_query = new WP_Query('post_type=archives&posts_per_page=3');
          while ($my_query->have_posts()) : $my_query->the_post();
                    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
    
        <div id="pee2"><a href="<?php the_permalink(); ?>"> <img align="left" height="280" src="<?php echo $url; ?>" /><h3><?php the_title(); ?></h3></a>
                   <object type="application/x-shockwave-flash" data="https://evrn.net/player_mp3_maxi.swf" width="200" height="20">
        <param name="movie" value="https://evrn.net/player_mp3_maxi.swf" />
        <param name="bgcolor" value="#000000" />
    
        <param name="FlashVars" value="mp3=<?php the_field( 'url' ); ?>" />
    </object><?php the_excerpt(); ?> </div>
    
    <?php endwhile;  wp_reset_query(); ?>
                </div><div id="time"><button class="scroll">Newest Stuff</button><button class="scroll2">Older Stuff</button><button class="scroll3">Oldest Stuff</button></div>
    <div id="pee">
                <?php //WordPress loop for custom post type
     $my_query = new WP_Query('post_type=magazine&posts_per_page=3');
          while ($my_query->have_posts()) : $my_query->the_post();
                    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
    
        <div id="pee2"><a href="<?php the_permalink() ?>" title="<?php printf( __( 'Permalink to %s', 'sandbox' ), the_title_attribute('echo=0') ) ?>" rel="bookmark"> <img align="left" height="280" src="<?php echo $url; ?>" /><h3><?php the_title(); ?></h3></a>
                   <?php the_excerpt(); ?> </div>
    
    <?php endwhile;  wp_reset_query(); ?>
                </div><div id="time"><button class="scroll">Newest Stuff</button><button class="scroll2">Older Stuff</button><button class="scroll3">Oldest Stuff</button></div>
    <div id="pee">
                <?php //WordPress loop for custom post type
     $my_query = new WP_Query('post_type=movies&posts_per_page=3');
          while ($my_query->have_posts()) : $my_query->the_post();
                    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
    
        <div id="pee2"><a href="<?php the_permalink() ?>" title="<?php printf( __( 'Permalink to %s', 'sandbox' ), the_title_attribute('echo=0') ) ?>" rel="bookmark"> <img align="left" height="280" src="<?php echo $url; ?>" /><h3><?php the_title(); ?></h3></a>
                  <?php the_excerpt(); ?>  </div>
    
    <?php endwhile;  wp_reset_query(); ?>
                </div><div id="time"><button class="scroll">Newest Stuff</button><button class="scroll2">Older Stuff</button><button class="scroll3">Oldest Stuff</button></div>
    <div id="pee">
                <?php //WordPress loop for custom post type
     $my_query = new WP_Query('post_type=games&posts_per_page=3');
          while ($my_query->have_posts()) : $my_query->the_post();
                    $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>
    
        <div id="pee2"><a href="<?php the_permalink() ?>" title="<?php printf( __( 'Permalink to %s', 'sandbox' ), the_title_attribute('echo=0') ) ?>" rel="bookmark"> <img align="left" height="280" src="<?php echo $url; ?>" /><h3><?php the_title(); ?></h3></a>
                <?php the_excerpt(); ?>    </div>
    
    <?php endwhile;  wp_reset_query(); ?>
                </div>
    		</div><!-- #content .hfeed -->
    	</div><!-- #container -->
    
    <?php get_sidebar() ?>
    <?php get_footer() ?>

    And then my javascript looks like this:

    <script>
    $(document).ready(function(){
      $(".scroll").click(function(){
        $("#content").scrollLeft(0);
      });
          $(".scroll2").click(function(){
        $("#content").scrollLeft(915);
      });
          $(".scroll3").click(function(){
        $("#content").scrollLeft(1830);
      });
    });
    $(window).scroll(function(){
    $('#time').css('center','-'+$(window).scrollLeft());
    });
    </script>

    Cheers!

  • The topic ‘Why can't my code permalink?’ is closed to new replies.