Esempio n. 1
0
    function shortcode_cpt_projects($params = array())
    {
        extract(shortcode_atts(array('title' => '', 'id' => '', 'width' => '', 'position' => '', 'cssid' => ''), $params));
        if (!empty($width) || !empty($position)) {
            if (!empty($width)) {
                $width_style = 'width: ' . $width . '%;';
                if (intval($width) <= 50) {
                    $classes[] = 'narrow';
                } elseif (intval($width) == 100) {
                    $classes[] = 'full-width';
                }
            }
            if (!empty($position)) {
                $classes[] = $position;
            }
            $style = 'style="' . $width_style . '"';
            $classes = implode(' ', $classes);
        }
        $args = array('post_type' => 'post_projects', 'post_status' => 'publish', 'pagination' => false, 'ignore_sticky_posts' => true);
        if ($id == 'latest') {
            $args = array_merge(array('posts_per_page' => 1, 'order' => 'DESC', 'orderby' => 'date'), $args);
        } else {
            $args = array_merge(array('p' => $id), $args);
        }
        $wp_query = null;
        $wp_query = new WP_Query($args);
        if ($wp_query->have_posts()) {
            while ($wp_query->have_posts()) {
                $wp_query->the_post();
                ob_start();
                ?>

				<div class="shortcode-preview shortcode-preview-post_projects single-cause single-project <?php 
                echo $classes;
                ?>
" itemscope itemtype="https://schema.org/Offer" <?php 
                echo $style;
                ?>
 id="<?php 
                echo $cssid;
                ?>
">
					<?php 
                if (!empty($title)) {
                    ?>
						<h2 class="preview-title"><?php 
                    echo $title;
                    ?>
</h2>
					<?php 
                } elseif (empty($title) && $id == 'latest') {
                    ?>
						<h2 class="preview-title"><?php 
                    the_title();
                    ?>
</h2>
					<?php 
                }
                ?>

					<figure class="single-cause-image">
						<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('gallery-thumb');
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/assets/images/gallery-thumb.png">';
                }
                ?>

						<figcaption>
							<div class="single-cause-buttons">
								<a href="<?php 
                the_permalink();
                ?>
" class="btn-red" itemprop="url"><?php 
                _e('Details', 'wplook');
                ?>
</a>
							</div><!-- /.single-cause-buttons -->
						</figcaption>
					</figure><!-- /.single-cause-image -->

					<div class="single-cause-body">
						<p><?php 
                echo wplook_short_excerpt(ot_get_option('wpl_projects_excerpt_limit'));
                ?>
</p>
					</div>

					<div class="single-cause-actions">
						<a href="<?php 
                the_permalink();
                ?>
" item-prop="url"><?php 
                _e('View Details', 'wplook');
                ?>
 <i class="fa fa-angle-right"></i></a>
					</div><!-- /.single-cause-actions -->
				</div><!-- /.single-project -->

			<?php 
                return ob_get_clean();
            }
        } else {
            return __('No posts found.', 'wplook');
        }
        wp_reset_postdata();
    }
Esempio n. 2
0
</a>
							</div><!-- /.single-cause-buttons -->
						</figcaption>
					</figure><!-- /.single-cause-image -->
					<a href="<?php 
            the_permalink();
            ?>
">
						<div class="single-cause-body">
							<h4 itemprop="name"><?php 
            the_title();
            ?>
</h4>

							<p><?php 
            echo wplook_short_excerpt(ot_get_option('wpl_cause_excerpt_limit'));
            ?>
</p>
						</div>

						<div class="single-cause-stats">
						<?php 
            if ($cause_location) {
                echo '<h5 itemprop="location">' . $cause_location . '</h5>';
            }
            ?>
							<div class="progress">
								<div class="progress-bar wow fadeInLeft" data-wow-duration="0.5s" data-wow-delay="0.4s" style="width: <?php 
            echo esc_attr($percentage);
            ?>
%;"></div>
Esempio n. 3
0
</a>
											</div><!-- /.single-event-buttons -->
										</figcaption>

									<?php 
        }
        ?>
							</figure><!-- /.single-event-image -->

							<div class="single-news-content">
								<?php 
        the_title(sprintf('<h3><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>');
        ?>
								<p>
									<?php 
        echo wplook_short_excerpt(ot_get_option('wpl_gallery_excerpt_limit'));
        ?>
									<a class="btn-read-more" href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('View gallery', 'charity-life-wpl');
        ?>
</a>
								</p>
							</div><!-- /.single-news-content -->
						</div><!-- /.single-news -->

						<?php 
    }
    ?>
Esempio n. 4
0
								<div class="single-news-meta">
									<ul>
										<?php 
        if ($event_date) {
            echo '<li itemprop="startDate"><i class="fa fa-calendar"></i> ' . esc_attr($event_date) . '</li>';
        }
        if ($event_fb_url != '') {
            echo '<li><i class="fa fa-facebook"></i> <a href="' . esc_attr($event_fb_url) . '">' . esc_attr('Facebook', 'wplook') . '</a></li>';
        }
        ?>
									</ul>
								</div><!-- /.single-news-meta -->
									<p>
										<?php 
        echo wplook_short_excerpt(ot_get_option('wpl_events_excerpt_limit'));
        ?>
										<a class="btn-read-more" href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('Continue Reading', 'charity-life-wpl');
        ?>
</a>
									</p>
							</div><!-- /.single-news-content -->
						</div><!-- /.single-news -->

						<?php 
    }
    ?>
Esempio n. 5
0
        if (ot_get_option('wpl_author_blog_post') == "on") {
            ?>
												<li>
													<i class="fa fa-user"></i>
													<?php 
            the_author();
            ?>
												</li>
											<?php 
        }
        ?>
										</ul>
									</div><!-- /.single-news-meta -->

									<p><?php 
        echo wplook_short_excerpt(ot_get_option('wpl_blog_excerpt_limit'));
        ?>
	<a class="btn-read-more" href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('Continue Reading', 'charity-life-wpl');
        ?>
</a></p>

								</div><!-- /.single-news-content -->
							</div><!-- /.single-news -->


						<?php 
    }
Esempio n. 6
0
        the_title(sprintf('<h3><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h3>');
        ?>

									<div class="single-cause-meta">
										<ul>
											<?php 
        if ($project_status != '') {
            echo '<li><i class="fa fa-bullhorn"></i> ' . esc_attr($project_status) . '</li>';
        }
        ?>

										</ul>
									</div><!-- /.single-cause-meta -->

									<p><?php 
        echo wplook_short_excerpt(ot_get_option('wpl_projects_excerpt_limit'));
        ?>
</p>
									<a class="btn-read-more" href="<?php 
        the_permalink();
        ?>
"><?php 
        _e('Continue Reading', 'charity-life-wpl');
        ?>
</a>

								</div><!-- /.single-cause-content -->
							</div><!-- /.single-cause -->
						<?php 
    }
    ?>
Esempio n. 7
0
            echo '<li itemprop="location"><i class="fa fa-map-marker"></i> ' . $cause_location . '</li>';
        }
        if ($cause_enddate) {
            echo '<li itemprop="startDate"><i class="fa fa-calendar"></i> ' . __('Ends', 'charity-life-wpl') . ' ' . $cause_enddate . '</li>';
        }
        if ($donations_number > 0) {
            $donation = sprintf(_n('%s Donation', '%s Donations', $donations_number, 'charity-life-wpl'), $donations_number);
            echo '<li><i class="fa fa-users"></i> ' . $donation . '</li>';
        }
        ?>

										</ul>
									</div><!-- /.single-cause-meta -->

									<p><?php 
        echo wplook_short_excerpt(22);
        ?>
</p>

									<div class="single-cause-stats">
										<div class="progress">
											<div class="progress-bar wow fadeInLeft" data-wow-duration="0.5s" data-wow-delay="0.4s" style="width: <?php 
        echo esc_attr($percentage);
        ?>
%;"></div>
										</div>

										<p>
											<?php 
        printf(__('%1$s of %2$s %3$s raised (%4$s%5$s)', 'charity-life-wpl'), esc_attr(wplook_format_money($donations_raised)), esc_attr(wplook_format_money($cause_goal_amount)), esc_attr(ot_get_option('wpl_curency_code')), esc_attr($percentage), '%');
        ?>
Esempio n. 8
0
    public function widget($args, $instance)
    {
        global $post;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
        $subtitle = apply_filters('widget_title', empty($instance['subtitle']) ? '' : $instance['subtitle'], $instance);
        $nr_posts = isset($instance['nr_posts']) ? esc_attr($instance['nr_posts']) : '';
        $display_type = isset($instance['display_type']) ? esc_attr($instance['display_type']) : '';
        // WP_Query arguments
        $args = array('post_type' => 'post_causes', 'post_status' => 'publish', 'pagination' => false, 'posts_per_page' => $nr_posts, 'orderby' => $display_type);
        // The Query
        $the_query = null;
        $the_query = new WP_Query($args);
        ?>

			<section class="section-carousel section-causes wow fadeIn" data-wow-duration="0.5s" data-wow-delay="0.4s">
				<div class="row">
					<header class="section-head" itemprop="name">
						<h5><?php 
        echo esc_html($subtitle);
        ?>
</h5>
						<h2><?php 
        echo esc_html($title);
        ?>
</h2>
					</header><!-- /.section-head -->
					<div class="section-body">
						<div class="causes-list owl-carousel">
		<?php 
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                $cause_meta = get_post_meta(get_the_ID());
                $donations_raised_number = wplook_donations_raised(get_the_ID());
                $donations_number = $donations_raised_number[0];
                $donations_raised = $donations_raised_number[1];
                $cause_goal_amount = isset($cause_meta['wpl_goal_amount'][0]) ? $cause_meta['wpl_goal_amount'][0] : 0;
                $cause_location = isset($cause_meta['wpl_location'][0]) ? $cause_meta['wpl_location'][0] : false;
                if ($cause_goal_amount > 0) {
                    $percentage = min(wplook_format_money($donations_raised * 100 / $cause_goal_amount, true), 100);
                } else {
                    $percentage = 0;
                }
                ?>

						<div class="single-cause" itemscope itemtype="https://schema.org/Offer">
							<figure class="single-cause-image">
								<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('gallery-thumb');
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/assets/images/gallery-thumb.png">';
                }
                ?>

								<figcaption>
									<div class="single-cause-buttons">
										<a href="<?php 
                the_permalink();
                ?>
" class="btn-red" itemprop="url"><?php 
                _e('Donate', 'charity-life-wpl');
                ?>
</a>
									</div><!-- /.single-cause-buttons -->
								</figcaption>
							</figure><!-- /.single-cause-image -->

							<a href="<?php 
                the_permalink();
                ?>
">
								<div class="single-cause-body">
									<h4 itemprop="name"><?php 
                the_title();
                ?>
</h4>

									<p><?php 
                echo wplook_short_excerpt(ot_get_option('wpl_cause_excerpt_limit'));
                ?>
</p>
								</div>

								<div class="single-cause-stats">
									<?php 
                if ($cause_location) {
                    echo '<h5>' . $cause_location . '</h5>';
                }
                ?>
									<div class="progress">
										<div class="progress-bar wow fadeInLeft" data-wow-duration="0.5s" data-wow-delay="0.4s" style="width: <?php 
                echo esc_attr($percentage);
                ?>
%;"></div>
									</div>

									<p>
										<?php 
                printf(__('%1$s of %2$s %3$s raised (%4$s%5$s)', 'charity-life-wpl'), esc_attr(wplook_format_money($donations_raised)), esc_attr(wplook_format_money($cause_goal_amount)), esc_attr(ot_get_option('wpl_curency_code')), esc_attr($percentage), '%');
                ?>
									</p>
								</div>
							</a>
						</div><!-- /.single-cause -->
			<?php 
            }
            ?>
		<?php 
        }
        ?>
		<?php 
        wp_reset_postdata();
        ?>
						</div><!-- /.causes-list owl-carousel -->
					</div><!-- /.section-body -->
				</div><!-- /.row -->
			</section><!-- /.section-carousel <?php 
        echo esc_attr($this->id);
        ?>
 -->
		<?php 
    }
Esempio n. 9
0
    public function widget($args, $instance)
    {
        global $post;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
        $subtitle = apply_filters('widget_title', empty($instance['subtitle']) ? '' : $instance['subtitle'], $instance);
        $categories = isset($instance['categories']) ? esc_attr($instance['categories']) : '';
        $nr_posts = isset($instance['nr_posts']) ? esc_attr($instance['nr_posts']) : '';
        $display_type = isset($instance['display_type']) ? esc_attr($instance['display_type']) : '';
        $background = apply_filters('widget_text', empty($instance['backgroundimg']) ? '' : $instance['backgroundimg'], $instance);
        // WP_Query arguments
        $args = array('post_type' => 'post_projects', 'post_status' => 'publish', 'pagination' => false, 'posts_per_page' => $nr_posts, 'orderby' => $display_type);
        if ($categories) {
            $args['tax_query'] = array(array('taxonomy' => 'wpl_projects_category', 'field' => 'id', 'terms' => $categories));
        }
        // The Query
        $the_query = null;
        $the_query = new WP_Query($args);
        ?>

			<section class="section-carousel section-projects wow fadeIn" data-wow-duration="0.5s" data-wow-delay="0.4s">
				<img src="<?php 
        echo esc_attr($background);
        ?>
" class="fullsize" />

				<div class="row">
					<header class="section-head" itemprop="name">
						<h5><?php 
        echo esc_html($subtitle);
        ?>
</h5>
						<h2><?php 
        echo esc_html($title);
        ?>
</h2>
					</header><!-- /.section-head -->
					<div class="section-body">
						<div class="projects-list owl-carousel">
		<?php 
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                ?>

				<div class="single-cause single-project">
					<figure class="single-cause-image">
						<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('gallery-thumb');
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/assets/images/gallery-thumb.png">';
                }
                ?>
						<figcaption>
							<div class="single-cause-buttons">
								<a href="<?php 
                the_permalink();
                ?>
" class="btn-red" itemprop="url"><?php 
                _e('Details', 'charity-life-wpl');
                ?>
</a>
							</div><!-- /.single-cause-buttons -->
						</figcaption>
					</figure><!-- /.single-cause-image -->

					<div class="single-cause-body">
						<h4 itemprop="name"><?php 
                the_title();
                ?>
</h4>

						<p><?php 
                echo wplook_short_excerpt(ot_get_option('wpl_projects_excerpt_limit'));
                ?>
</p>
					</div>

					<div class="single-cause-actions">
						<a href="<?php 
                the_permalink();
                ?>
" item-prop="url"><?php 
                _e('View Details', 'charity-life-wpl');
                ?>
 <i class="fa fa-angle-right"></i></a>
					</div><!-- /.single-cause-actions -->
				</div><!-- /.single-project -->

			<?php 
            }
            ?>
		<?php 
        }
        ?>
		<?php 
        wp_reset_postdata();
        ?>
						</div><!-- /.projects-list owl-carousel -->
					</div><!-- /.section-body -->
				</div><!-- /.row -->
			</section><!-- /.section-carousel  <?php 
        echo esc_attr($this->id);
        ?>
 -->
		<?php 
    }
Esempio n. 10
0
    public function widget($args, $instance)
    {
        global $post;
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance);
        $categories = isset($instance['categories']) ? esc_attr($instance['categories']) : '';
        $nr_posts = isset($instance['nr_posts']) ? esc_attr($instance['nr_posts']) : '';
        $display_type = isset($instance['display_type']) ? esc_attr($instance['display_type']) : '';
        // WP_Query arguments
        $args = array('post_type' => 'post_projects', 'post_status' => 'publish', 'pagination' => false, 'posts_per_page' => $nr_posts, 'orderby' => $display_type);
        if ($categories) {
            $args['tax_query'] = array(array('taxonomy' => 'wpl_projects_category', 'field' => 'id', 'terms' => $categories));
        }
        // The Query
        $the_query = null;
        $the_query = new WP_Query($args);
        ?>

			<div class="widget">
				<div class="widget-head">
					<h4 class="widget-title"><?php 
        echo esc_html($title);
        ?>
</h4><!-- /.widget-title -->
				</div><!-- /.widget-head -->

				<div class="widget-body">

		<?php 
        if ($the_query->have_posts()) {
            while ($the_query->have_posts()) {
                $the_query->the_post();
                ?>

					<div class="single-cause single-project" itemscope itemtype="https://schema.org/Offer">
						<figure class="single-cause-image">
							<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('gallery-thumb');
                } else {
                    echo '<img src="' . get_template_directory_uri() . '/assets/images/gallery-thumb.png">';
                }
                ?>

							<figcaption>
								<div class="single-cause-buttons">
									<a href="<?php 
                the_permalink();
                ?>
" class="btn-red" itemprop="url"><?php 
                _e('Details', 'charity-life-wpl');
                ?>
</a>
								</div><!-- /.single-cause-buttons -->
							</figcaption>
						</figure><!-- /.single-cause-image -->

						<div class="single-cause-body">
							<h4 itemprop="name"><?php 
                the_title();
                ?>
</h4>

							<p><?php 
                echo wplook_short_excerpt(ot_get_option('wpl_projects_excerpt_limit'));
                ?>
</p>
						</div>

						<div class="single-cause-actions">
							<a href="<?php 
                the_permalink();
                ?>
" item-prop="url"><?php 
                _e('View Details', 'charity-life-wpl');
                ?>
 <i class="fa fa-angle-right"></i></a>
						</div><!-- /.single-cause-actions -->
					</div><!-- /.single-project -->

			<?php 
            }
            ?>
		<?php 
        }
        ?>
		<?php 
        wp_reset_postdata();
        ?>
				</div><!-- /.widget-body -->
			</div><!-- /.widget widget-latest <?php 
        echo esc_attr($this->id);
        ?>
 -->
		<?php 
    }