wordpress manÅŸet sistemi


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- SLIDER -->
  2. <div class="slider main">
  3. <div class="sliderContainer">
  4. <ul class="mainSlider">
  5.  
  6. <?php
  7. $anaHaber = new WP_Query();
  8. $anaHaber->query('post_type=headline&order=ASC&showposts=4'); ?>
  9. <?php while ($anaHaber->have_posts()) : $anaHaber->the_post(); ?>
  10. <?php
  11. $anaHaberResim = get_children(array(
  12. 'post_parent' => get_the_ID(),
  13. 'post_type' => 'attachment',
  14. 'numberposts' => 1,
  15. 'order' => 'DESC',
  16. 'orderby' => 'date',
  17. 'post_mime_type' => 'image'));
  18. $i=1;
  19. foreach($anaHaberResim as $listele) {
  20. $img=wp_get_attachment_image_src($listele->ID, 'mainSlider');
  21. $cap=$listele->post_title;
  22. }
  23. ?>
  24. <li>
  25. <a href="<?php the_permalink(); ?>"><img src="<?php echo $img[0]; ?>" alt="<?php echo $cap; ?>"></a>
  26. </li>
  27. <?php $i++; endwhile; ?>
  28.  
  29. </ul>
  30. </div>
  31. <ul class="sliderNav">
  32. <?php for($x=1;$x<=$i;$x++) { ?>
  33. <li <?php if($x==$i) { echo 'class="noMargin"'; } ?>><a href="javascript:;"><?php echo $x; ?></a></li>
  34. <?php }?>
  35. </ul>
  36. </div>
  37. <!-- SLIDER -->

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.