the_post(); echo gdlr_get_cause_thumbnail($theme_option['cause-thumbnail-size']); echo '<div class="gdlr-cause-info-wrapper">'; echo gdlr_get_cause_info(array('date', 'category')); if (!empty($gdlr_post_option['goal-of-donation'])) { echo '<div class="gdlr-cause-donation-goal">'; echo __('Donation Goal For This Project is', 'gdlr-cause') . ' '; echo '<span class="goal">'; echo gdlr_cause_money_format($gdlr_post_option['goal-of-donation']); echo '</span>'; echo '</div>'; } echo gdlr_cause_donation_amount($gdlr_post_option['goal-of-donation'], $gdlr_post_option['current-funding']); echo gdlr_get_cause_info(array('pdf'), $gdlr_post_option, false); echo '<div class="clear"></div>'; echo gdlr_cause_donation_button($gdlr_post_option); echo '<div class="clear"></div>'; echo '</div>'; echo '<div class="gdlr-cause-content" >'; the_content(); echo '</div>'; } ?> </div><!-- #cause --> </div> </div> <?php get_sidebar('left'); ?> <div class="clear"></div> </div>
function gdlr_print_urgent_cause($settings) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $post, $gdlr_spaces, $gdlr_excerpt_read_more; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin .= !empty($settings['min-height']) ? ' min-height: ' . $settings['min-height'] . 'px; ' : ''; // excerpt number if (!empty($settings['num-excerpt'])) { global $gdlr_excerpt_length; $gdlr_excerpt_length = $settings['num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); } $posts = get_posts(array('name' => $settings['cause'], 'post_type' => 'cause', 'posts_per_page' => 1)); foreach ($posts as $post) { setup_postdata($post); $cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true); $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { $image_src = wp_get_attachment_image_src($image_id, 'full'); $margin .= ' background: url(' . $image_src[0] . ') center 0px; '; } $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $ret = '<div class="urgent-cause-wrapper gdlr-item" ' . $item_id . $margin_style . '>'; $ret .= '<div class="urgent-cause-overlay" ></div>'; $ret .= '<div class="urgent-cause-inner" >'; $ret .= '<div class="urgent-cause-caption">' . $settings['title'] . '</div>'; $ret .= '<h3 class="urgent-cause-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; $ret .= '<div class="urgent-cause-content">' . get_the_excerpt() . '</div>'; $ret .= '<div class="urgent-cause-info">'; $ret .= gdlr_cause_donation_button($cause_option); $ret .= gdlr_cause_donation_amount($cause_option['goal-of-donation'], $cause_option['current-funding']); $ret .= '<div class="clear"></div>'; $ret .= '</div>'; // urgent-cause-info $ret .= '</div>'; // urgent-cause-inner $ret .= '</div>'; } remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); wp_reset_postdata(); return $ret; }
function gdlr_get_post_slider_item($settings) { $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" '; global $gdlr_spaces; $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : ''; $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : ''; $slide_order = array(); $slide_data = array(); // query posts section $settings['post-type'] = empty($settings['post-type']) ? 'post' : $settings['post-type']; $args = array('post_type' => $settings['post-type'], 'suppress_filters' => false); $args['posts_per_page'] = empty($settings['num-fetch']) ? '5' : $settings['num-fetch']; $args['orderby'] = empty($settings['orderby']) ? 'post_date' : $settings['orderby']; $args['order'] = empty($settings['order']) ? 'desc' : $settings['order']; if ($settings['post-type'] == 'cause' && $settings['cause-category']) { $args['tax_query'] = array(array('terms' => explode(',', $settings['cause-category']), 'taxonomy' => 'cause_category', 'field' => 'slug')); } else { if ($settings['post-type'] == 'post') { $args['tax_query'] = array(array('terms' => explode(',', $settings['category']), 'taxonomy' => 'category', 'field' => 'slug')); } } $args['ignore_sticky_posts'] = 1; $query = new WP_Query($args); // set the excerpt length global $theme_option, $gdlr_excerpt_length, $gdlr_excerpt_read_more; $gdlr_excerpt_length = $settings['num-excerpt']; add_filter('excerpt_length', 'gdlr_set_excerpt_length'); global $post; while ($query->have_posts()) { $query->the_post(); $image_id = get_post_thumbnail_id(); if (!empty($image_id)) { $slide_order[] = $image_id; $slide_data[$image_id] = array('title' => get_the_title(), 'slide-link' => 'url', 'url' => get_permalink(), 'new-tab' => 'disable', 'caption-position' => $settings['caption-style']); $slide_data[$image_id]['caption'] = '<div class="post-slider-caption-overlay"></div>'; if ($settings['post-type'] == 'post') { $slide_data[$image_id]['caption'] .= '<div class="blog-info blog-date"><i class="icon-time"></i>'; $slide_data[$image_id]['caption'] .= get_the_time($theme_option['date-format']); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="blog-info blog-comment"><i class="icon-comment"></i>'; $slide_data[$image_id]['caption'] .= get_comments_number(); $slide_data[$image_id]['caption'] .= '</div>'; $slide_data[$image_id]['caption'] .= '<div class="clear"></div>'; } $slide_data[$image_id]['caption'] .= get_the_excerpt(); if ($settings['post-type'] == 'cause' && function_exists('gdlr_cause_donation_button')) { $cause_option = json_decode(gdlr_decode_preventslashes(get_post_meta(get_the_ID(), 'post-option', true)), true); $slide_data[$image_id]['caption'] .= gdlr_cause_donation_button($cause_option); } } } remove_filter('excerpt_length', 'gdlr_set_excerpt_length'); $feature_text = ''; if ($settings['caption-style'] != 'post-bottom post-slider') { if ($settings['post-type'] == 'cause') { $feature_text = __('Featured Causes', 'gdlr_translate'); } else { $feature_text = __('Featured Posts', 'gdlr_translate'); } } $ret = '<div class="gdlr-item gdlr-post-slider-item style-' . $settings['caption-style'] . '" ' . $item_id . $margin_style . ' >'; $ret .= gdlr_get_slider(array($slide_order, $slide_data), $settings['thumbnail-size'], 'flexslider', $feature_text); $ret .= '</div>'; return $ret; }