<!--swiper begin--> <div class="swiper-container"> <div class="swiper-wrapper"> <?php $media_items = get_attachments_by_media_tags('media_tags=cover'); if ($media_items) { foreach ($media_items as $cover_itm) { echo '<div class="swiper-slide"><img src="' . $cover_itm->guid . '"/>'; echo '<div class="pencislider-container penci-fadeInDown align-left">'; echo '<div class="pencislider-content">'; echo '<h4 class="pencislider-title">' . $cover_itm->post_excerpt . '</h4>'; echo '<p>' . $cover_itm->post_content . '</p>'; echo '<div class="penci-button"><a class="pencislider-button" href="' . get_post_permalink($cover_itm->post_parent) . '/">'; if (pll_current_language() == 'am') { echo get_term_by('slug', 'read-more-am', 'post_tag')->name; } else { echo get_term_by('slug', 'read-more', 'post_tag')->name; } echo '</a></div>'; echo '</div>'; echo '</div>'; echo '</div>'; } } ?> </div> <!-- Add Pagination --> <div class="swiper-pagination"></div> <!-- Add Arrows --> <div class="swiper-button-next"></div>
function images_from_library($attr, $options) { /* ** Generate a list of the images we are using from the Media Library */ if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } /* ** Standard gallery shortcode defaults that we support here */ global $post; extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'include' => '', 'exclude' => '', 'mediatag' => ''), $attr)); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($mediatag)) { $mediaList = get_attachments_by_media_tags("media_tags={$mediatag}&orderby={$orderby}&order={$order}"); $attachments = array(); foreach ($mediaList as $key => $val) { $attachments[$val->ID] = $mediaList[$key]; } } elseif (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } $image_list = array(); foreach ($attachments as $id => $attachment) { $small_image = wp_get_attachment_image_src($id, "medium"); $large_image = wp_get_attachment_image_src($id, "large"); /* If the media description contains an url and the link option is enabled, use the media description as the linkurl */ $link_url = ''; if ($options['link'] == 'true' && (substr($attachment->post_content, 0, 7) == 'http://' || substr($attachment->post_content, 0, 8) == 'https://')) { $link_url = $attachment->post_content; } $image_link = get_post_meta($id, '_iscp-image-link', true); if (isset($image_link) && $image_link != '') { $link_url = $image_link; } $image_list[] = array('small' => $small_image[0], 'large' => $large_image[0], 'link' => $link_url, 'title' => $attachment->post_title, 'desc' => $attachment->post_content); } return $image_list; }
function galleryBuiltin($attr) { /* ** Use the built-in gallery images */ if (isset($attr['orderby'])) { $attr['orderby'] = sanitize_sql_orderby($attr['orderby']); if (!$attr['orderby']) { unset($attr['orderby']); } } /* ** Standard gallery shortcode defaults that we support here */ global $post; extract(shortcode_atts(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', 'mediatag' => ''), $attr)); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } if (!empty($mediatag)) { $mediaList = get_attachments_by_media_tags("media_tags={$mediatag}&orderby={$orderby}&order={$order}"); $attachments = array(); foreach ($mediaList as $key => $val) { $attachments[$val->ID] = $mediaList[$key]; } } elseif (!empty($include)) { $include = preg_replace('/[^0-9,]+/', '', $include); $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $exclude = preg_replace('/[^0-9,]+/', '', $exclude); $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) { $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; } return $output; } /* ** Get options for ImageFlow2 gallery display */ $options = $this->getAdminOptions(); $bgcolor = $options['bgcolor']; $txcolor = $options['txcolor']; $slcolor = $options['slcolor']; $width = $options['width']; $link = $options['link']; $reflect = $options['reflect']; $strict = $options['strict']; $plugin_url = get_option('siteurl') . "/" . PLUGINDIR . "/" . plugin_basename(dirname(__FILE__)); /** * Start output */ $noscript = '<noscript><div id="' . $this->noscriptdiv . '_' . $this->wpif2_instance . '" class="' . $this->noscriptdiv . '">'; $output = '<div id="' . $this->imageflow2div . '_' . $this->wpif2_instance . '" class="' . $this->imageflow2div . '" style="background-color: ' . $bgcolor . '; color: ' . $txcolor . '; width: ' . $width . '">' . PHP_EOL; $output .= '<div id="' . $this->loadingdiv . '_' . $this->wpif2_instance . '" class="' . $this->loadingdiv . '" style="color: ' . $txcolor . ';">' . PHP_EOL; $output .= '<b>'; $output .= __('Loading Images', 'wp-imageflow2'); $output .= '</b><br/>' . PHP_EOL; $output .= '<img src="' . $plugin_url . '/img/loading.gif" width="208" height="13" alt="' . $loadingdiv . '" />' . PHP_EOL; $output .= '</div>' . PHP_EOL; $output .= '<div id="' . $this->imagesdiv . '_' . $this->wpif2_instance . '" class="' . $this->imagesdiv . '">' . PHP_EOL; /** * Add images */ $i = 0; foreach ($attachments as $id => $attachment) { $image = wp_get_attachment_image_src($id, "medium"); $image_large = wp_get_attachment_image_src($id, "large"); if ($strict == 'true') { $dir_array = parse_url($image[0]); $url_path = $dir_array['path']; $pic_reflected = $plugin_url . '/php/reflect.php?img=' . urlencode($url_path) . '&bgc=' . urlencode($bgcolor); } else { $pic_reflected = $plugin_url . '/php/reflect.php?img=' . urlencode($image[0]) . '&bgc=' . urlencode($bgcolor); } $pic_original = $image[0]; $pic_large = $image_large[0]; $linkurl = ''; $rel = ''; /* If the media description contains an url and the link option is enabled, use the media description as the linkurl */ if ($link == 'true' && substr($attachment->post_content, 0, 7) == 'http://') { $linkurl = $attachment->post_content; } if ($linkurl === '') { /* We are linking to the popup - use the title and description as the alt text */ $linkurl = $pic_large; $rel = ' rel="wpif2_lightbox"'; $alt = ' alt="' . $attachment->post_title . "++" . $attachment->post_content . '"'; } else { /* We are linking to an external url - use the title as the alt text */ $alt = ' alt="' . $attachment->post_title . '"'; } /* Note that IE gets confused if we put newlines after each image, so we don't */ if ($reflect == 'true') { $output .= '<img src="' . $pic_reflected . '" longdesc="' . $linkurl . '"' . $rel . $alt . ' />'; } else { $output .= '<img src="' . $pic_original . '" longdesc="' . $linkurl . '"' . $rel . $alt . ' />'; } /* build separate thumbnail list for users with scripts disabled */ $noscript .= '<a href="' . $linkurl . '"><img src="' . $pic_original . '" width="100px"></a>'; $i++; } $output .= '</div>' . PHP_EOL; $output .= '<div id="' . $this->captionsdiv . '_' . $this->wpif2_instance . '" class="' . $this->captionsdiv . '"></div>' . PHP_EOL; $output .= '<div id="' . $this->scrollbardiv . '_' . $this->wpif2_instance . '" class="' . $this->scrollbardiv; if ($slcolor == "black") { $output .= ' black'; } $output .= '"><div id="' . $this->sliderdiv . '_' . $this->wpif2_instance . '" class="' . $this->sliderdiv . '">' . PHP_EOL; $output .= '</div>'; $output .= '</div>' . PHP_EOL; $output .= $noscript . '</div></noscript></div>'; return $output; }
function main() { //The main action hook function //first, dig out the photos we already have $args = array('orderby' => 'date', 'order' => 'DESC'); //Check and add new photos foreach ($this->galleries as $gallery) { $args['media_tags'] = $gallery['mediatag']; $old_photos = get_attachments_by_media_tags($args); $this->add_new_recursive(1, $old_photos, $gallery); } }