Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: skrypt w szablonie wordpressa - pytanie laika
Forum PHP.pl > Forum > Po stronie przeglądarki > JavaScript
bragi
Cześć,
to mój pierwszy post, więc jeśli coś przekręciłem, to przepraszam. Te subforum chyba najlepiej nadaje sie do tego tematu. Korzystam z silnika Wordpress na którym mam zainstalowany szablon Traction. demo widać tutaj: http://demo.thethemefoundry.com/traction/. Cały problem jaki mam, tkwi w samym sliderze - czyli elemencie "Featured Articles" problem w tym, że na moim blogu, skrypt generuje i wstawia mi tam wszystkie wpisy z bloga z pierwszej strony. Ja natomiast chciałbym, aby wstawiał tam tylko wpisy, które ja wybiorę. Trochę szukałem i znalazłem taki opis: http://ourthemes.blog.com/traction-featured-slider/ niestety nie za bardzo wiem co zrobić z drugą częścią, tak czy siak jestem w lesie.

Dalej, szukałem w plikach php i dotarłem do pliku :
  1. <div class="feature-top clear"></div>
  2. <div id="feature" class="clear">
  3. <div class="feature-main">
  4. <div class="container">
  5. <div class="slides">
  6. <?php query_posts(array( 'post__in'=>get_option( 'sticky_posts' ))); ?>
  7. <?php global $more; $more = 0; ?>
  8. <?php if (have_posts()) : while (have_posts()) : the_post(); $count_1++; ?>
  9. <div id="slide-<?php echo $count_1; ?>" class="slide">
  10. <?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail( 'feature-big', array( 'class' => 'feature-photo' )); ?>
  11. <h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
  12. <?php the_content(__( 'Read more', 'traction' )); ?>
  13. </div>
  14. <?php endwhile; endif; ?>
  15. </div>
  16. </div>
  17. </div><!--end feature-main-->
  18. <div class="feature-sidebar">
  19. <h2><?php _e( 'Featured Articles', 'traction' ); ?></h2>
  20. <ul class="pagination">
  21. <?php query_posts(array( 'post__in'=>get_option( 'sticky_posts' ))); ?>
  22. <?php if (have_posts()) : while (have_posts()) : the_post(); $count_2++; ?>
  23. <?php $custom_field_description = get_post_meta($post->ID, 'short-description', $single = true); ?>
  24. <li id="slide-nav-<?php echo $count_2; ?>">
  25. <a class="clear" href="#">
  26. <?php if ( function_exists( 'add_theme_support' ) ) the_post_thumbnail( 'feature-small' ); ?>
  27. <strong><?php the_title(); ?></strong>
  28. <span><?php echo $custom_field_description; ?></span>
  29. </a>
  30. </li>
  31. <?php endwhile; endif; ?>
  32. <?php wp_reset_query(); ?>
  33. </ul>
  34. <?php if ($count_2 > 1) { ?>
  35. <div id="slider-arrows">
  36. <div class="slider-nav-left">
  37. <a class="previous" href="#"><img src="<?php bloginfo( 'template_url' ); ?>/images/feature-sld-nav-left.png" alt="Scroll left" width="32" height="27"/></a>
  38. </div>
  39. <div class="slider-nav-right">
  40. <a class="next" href="#"><img src="<?php bloginfo( 'template_url' ); ?>/images/feature-sld-nav-right.png" alt="Scroll right" width="32" height="27"/></a>
  41. </div>
  42. </div><!--end slider-arrows-->
  43. <?php } ?>
  44. </div><!--end feature-sidebar-->
  45. </div><!--end feature-->
  46. <div class="feature-bottom clear"></div>


ale, na tyle moja wiedza mi wystarczy, aby się zorientowac, że ten skrypt jedynie generuje cały wygląd tej cześci bloga.
A więc trafiłem potem na odpowiedni skrypt, który wszystko generuje, niestety tutaj kończy się moja wiedza na ten temat i nie mam żadnego pojęcia, na jakiej zasadzie są wybierane wpisy.
tutaj ten końcowy skrypt: http://pokazkod.pl/0978bbd3d240e7a8077ae34...f7d7472a3d6675b lub tutaj http://pokazkod.pl/0978bbd3d240e7a8077ae34...f7d74f76797e6f9

pomożecie mi jakoś ?
Pozdrawiam
Michał
pancerny
Podbijam. Siedzę nad tym drugi dzień i nie mogę nic wykombinować :/
matird
Moze zle zrozumialem problem, ale wydaje mi sie ze to raczej nie JS tylko PHP. Jesli chodzi o wordpressa to wyswietlanie postow generuje funkcja query_posts :

http://codex.wordpress.org/Function_Reference/query_posts

czyli np. chcac wyswietlic wszystko z kategorii 3:

query_posts( 'cat=3' );

itd... opcji jest wieeele

o to chodzi ?
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.