Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript][PHP]galeria ala portfolio sklep
Forum PHP.pl > Forum > Przedszkole
matiz123
Witajcie. Otóż mam takie pytanie czy jest jakaś galeria na wordpressa bądź jakiś inny plugin aby zrobić coś takiego:
Potrzebuję stworzyc galerię zdjęć, gdzie po najechaniu na dane zdjęcie będzie można wybrać czy je powiększyć czy przejść do strony gdzie będzie duże zdjęcei tego przedmiotu i jego opis.

bardzo serdecznie proszę o pomoc

Pozdrawiam i z góry dzięki
Korab
A co to za problem napisać coś takiego? Podpinasz np. do każdego zdjęcia zdarzenie hover, po najechaniu na zdjęcie pojawiają się obok niego/nad nim/na nim ikonki lupy i np. strzałki (z atrybutem alt "Więcej"). Po kliknięciu na lupę odpala się lightbox (ikonka lupy jest odnośnikiem do dużej wersji danego obrazu, wtedy Lightbox obsłuży to bez problemu), a strzałka jest linkiem do strony z informacjami o przedmiocie.
matiz123
Dzięki bardzo za odpowiedź

A czy to hover mam nanieść w pliku .js czy .css?
Znalazłem taki kod czy da się gdzieś wpisać taki scrypt z tym hover?
Ja jestem troszkę zielony w tym temacie ale jeśli powiedział być mi gdzie wewentualnie mam coś takiego wpisać to później sam bym czegoś spróbował poszukać i wpisać.

Dzięki z góry

  1. function gallery_shortcode($attr) {
  2. $post = get_post();
  3.  
  4. static $instance = 0;
  5. $instance++;
  6.  
  7. if ( ! empty( $attr['ids'] ) ) {
  8. // 'ids' is explicitly ordered, unless you specify otherwise.
  9. if ( empty( $attr['orderby'] ) )
  10. $attr['orderby'] = 'post__in';
  11. $attr['include'] = $attr['ids'];
  12. }
  13.  
  14. // Allow plugins/themes to override the default gallery template.
  15. $output = apply_filters('post_gallery', '', $attr);
  16. if ( $output != '' )
  17. return $output;
  18.  
  19. // We're trusting author input, so let's at least make sure it looks like a valid orderby statement
  20. if ( isset( $attr['orderby'] ) ) {
  21. $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] );
  22. if ( !$attr['orderby'] )
  23. unset( $attr['orderby'] );
  24. }
  25.  
  26. extract(shortcode_atts(array(
  27. 'order' => 'ASC',
  28. 'orderby' => 'menu_order ID',
  29. 'id' => $post->ID,
  30. 'itemtag' => 'dl',
  31. 'icontag' => 'dt',
  32. 'captiontag' => 'dd',
  33. 'columns' => 3,
  34. 'size' => 'thumbnail',
  35. 'include' => '',
  36. 'exclude' => ''
  37. ), $attr));
  38.  
  39. $id = intval($id);
  40. if ( 'RAND' == $order )
  41. $orderby = 'none';
  42.  
  43. if ( !empty($include) ) {
  44. $_attachments = get_posts( array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  45.  
  46. $attachments = array();
  47. foreach ( $_attachments as $key => $val ) {
  48. $attachments[$val->ID] = $_attachments[$key];
  49. }
  50. } elseif ( !empty($exclude) ) {
  51. $attachments = get_children( array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  52. } else {
  53. $attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
  54. }
  55.  
  56. if ( empty($attachments) )
  57. return '';
  58.  
  59. if ( is_feed() ) {
  60. $output = "\n";
  61. foreach ( $attachments as $att_id => $attachment )
  62. $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
  63. return $output;
  64. }
  65.  
  66. $itemtag = tag_escape($itemtag);
  67. $captiontag = tag_escape($captiontag);
  68. $icontag = tag_escape($icontag);
  69. $valid_tags = wp_kses_allowed_html( 'post' );
  70. if ( ! isset( $valid_tags[ $itemtag ] ) )
  71. $itemtag = 'dl';
  72. if ( ! isset( $valid_tags[ $captiontag ] ) )
  73. $captiontag = 'dd';
  74. if ( ! isset( $valid_tags[ $icontag ] ) )
  75. $icontag = 'dt';
  76.  
  77. $columns = intval($columns);
  78. $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
  79. $float = is_rtl() ? 'right' : 'left';
  80.  
  81. $selector = "gallery-{$instance}";
  82.  
  83. $gallery_style = $gallery_div = '';
  84. if ( apply_filters( 'use_default_gallery_style', true ) )
  85. $gallery_style = "
  86. <style type='text/css'>
  87. #{$selector} {
  88. margin: auto;
  89. }
  90. #{$selector} .gallery-item {
  91. float: {$float};
  92. margin-top: 10px;
  93. text-align: center;
  94. width: {$itemwidth}%;
  95. }
  96. #{$selector} img {
  97. border: 2px solid #cfcfcf;
  98. }
  99. #{$selector} .gallery-caption {
  100. margin-left: 0;
  101. }
  102. </style>
  103. <!-- see gallery_shortcode() in wp-includes/media.php -->";
  104. $size_class = sanitize_html_class( $size );
  105. $gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
  106. $output = apply_filters( 'gallery_style', $gallery_style . "\n\t\t" . $gallery_div );
  107.  
  108. $i = 0;
  109. foreach ( $attachments as $id => $attachment ) {
  110. $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
  111.  
  112. $output .= "<{$itemtag} class='gallery-item'>";
  113. $output .= "
  114. <{$icontag} class='gallery-icon'>
  115. $link
  116. </{$icontag}>";
  117. if ( $captiontag && trim($attachment->post_excerpt) ) {
  118. $output .= "
  119. <{$captiontag} class='wp-caption-text gallery-caption'>
  120. " . wptexturize($attachment->post_excerpt) . "
  121. </{$captiontag}>";
  122. }
  123. $output .= "</{$itemtag}>";
  124. if ( $columns > 0 && ++$i % $columns == 0 )
  125. $output .= '<br style="clear: both" />';
  126. }
  127.  
  128. $output .= "
  129. <br style='clear: both;' />
  130. </div>\n";
  131.  
  132. return $output;
  133. }
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.