function widget($args, $instance)
    {
        global $gdl_widget_date_format;
        extract($args);
        $num_fetch = $instance['num_fetch'];
        $category = $instance['category'];
        if ($category == "All") {
            $category = '';
        }
        echo $before_widget;
        $query_arrays = array(array('id' => 'gdl-widget-latest-post', 'title' => __('RECENT', 'gdl_front_end'), 'type' => 'post', 'condition' => 'showposts=' . $num_fetch . '&suppress_filters=0&category_name=' . $category), array('id' => 'gdl-widget-popular-post', 'title' => __('POPULAR', 'gdl_front_end'), 'type' => 'post', 'condition' => 'showposts=' . $num_fetch . '&suppress_filters=0&category_name=' . $category . '&orderby=comment_count'), array('id' => 'gdl-widget-latest-comment', 'title' => __('COMMENTS', 'gdl_front_end'), 'type' => 'comment'));
        echo '<div class="gdl-tab-widget-wrapper">';
        // Tab header
        $current_tab = ' active ';
        echo '<div class="gdl-tab-widget-header-wrapper">';
        foreach ($query_arrays as $query_array) {
            echo '<h4 class="gdl-tab-widget-header-item">';
            echo '<a class="' . $current_tab . '" data-id="' . $query_array['id'] . '">';
            echo $query_array['title'];
            echo '</a>';
            echo '</h4>';
            $current_tab = '';
        }
        echo '<div class="clear"></div>';
        echo '</div>';
        // gdl-tab-widget-header-wrapper
        // Tab content
        $current_tab = ' active ';
        echo '<div class="gdl-tab-widget-content-wrapper">';
        foreach ($query_arrays as $query_array) {
            echo '<div class="gdl-tab-widget-content-item ' . $current_tab . '" data-id="' . $query_array['id'] . '">';
            if ($query_array['type'] == 'post') {
                $custom_posts = get_posts($query_array['condition']);
                echo '<div class="gdl-recent-post-widget">';
                foreach ($custom_posts as $custom_post) {
                    ?>
					<div class="recent-post-widget">
						<?php 
                    $thumbnail_id = get_post_thumbnail_id($custom_post->ID);
                    $thumbnail = wp_get_attachment_image_src($thumbnail_id, '75x55');
                    if ($thumbnail_id) {
                        echo '<div class="recent-post-widget-thumbnail">';
                        echo '<a href="' . get_permalink($custom_post->ID) . '">';
                        $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
                        if (!empty($thumbnail)) {
                            echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>';
                        }
                        echo '</a>';
                        echo '</div>';
                    }
                    ?>
						
						<div class="recent-post-widget-context">
							<h4 class="recent-post-widget-title">
								<a href="<?php 
                    echo get_permalink($custom_post->ID);
                    ?>
"> 
									<?php 
                    _e($custom_post->post_title, 'gdl_front_end');
                    ?>
 
								</a>
							</h4>
							<div class="recent-post-widget-info">
								<div class="recent-post-widget-date">
									<?php 
                    echo '<a href="' . get_day_link(get_the_time('Y', $custom_post->ID), get_the_time('m', $custom_post->ID), get_the_time('d', $custom_post->ID)) . '" >';
                    echo __('Posted On', 'gdl_front_end') . ' ';
                    echo get_the_time($gdl_widget_date_format, $custom_post->ID);
                    echo '</a>';
                    ?>
								</div>		
							</div>
						</div>
						<div class="clear"></div>
					</div>						
					<?php 
                }
                echo '</div>';
            } else {
                $posts_in_cat = get_post_title_id($category);
                $recent_comments = get_comments(array('post_id__in' => $posts_in_cat, 'number' => $num_fetch, 'status' => 'approve'));
                echo '<div class="gdl-recent-comment-widget">';
                foreach ($recent_comments as $recent_comment) {
                    $comment_permalink = get_permalink($recent_comment->comment_post_ID) . '#comment-' . $recent_comment->comment_ID;
                    ?>
					<div class="recent-comment-widget" >
						<div class="recent-comment-widget-thumbnail">
							<a href="<?php 
                    echo $comment_permalink;
                    ?>
">
								<?php 
                    echo get_avatar($recent_comment->user_id, 55);
                    ?>
							</a>
						</div>
						<div class="recent-comment-widget-context">
							<h4 class="recent-comment-widget-title">
								<a href="<?php 
                    echo $comment_permalink;
                    ?>
"> 
									<?php 
                    echo gdl_get_excerpt(45, '...', __($recent_comment->comment_content, 'gdl_front_end'));
                    ?>
 
								</a>
							</h4>
							<div class="recent-comment-widget-info">
								<div class="recent-comment-widget-date">
									<?php 
                    echo __('Posted On', 'gdl_front_end');
                    ?>
									<?php 
                    echo get_comment_date($gdl_widget_date_format, $recent_comment->comment_ID);
                    ?>
								</div>		
							</div>
						</div>
						<div class="clear"></div>
					</div>
					<?php 
                }
                echo '</div>';
            }
            echo '</div>';
            $current_tab = '';
        }
        echo '</div>';
        // gdl-tab-widget-content-wrapper
        echo '<div class="clear"></div>';
        echo '</div>';
        // gdl-widget-tab
        echo $after_widget;
        wp_deregister_script('gdl-tab-widget');
        wp_register_script('gdl-tab-widget', GOODLAYERS_PATH . '/javascript/gdl-tab-widget.js', false, '1.0', true);
        wp_enqueue_script('gdl-tab-widget');
    }
示例#2
0
function print_blog_full($item_class, $item_size, $num_excerpt, $full_content = "No")
{
    global $gdl_admin_translator, $more, $gdl_date_format;
    if ($full_content == 'Yes') {
        $more = 0;
    }
    if ($gdl_admin_translator == 'enable') {
        $translator_continue_reading = get_option(THEME_SHORT_NAME . '_translator_continue_reading', 'Continue Reading');
    } else {
        $translator_continue_reading = __('Continue Reading', 'gdl_front_end');
    }
    while (have_posts()) {
        the_post();
        echo '<div class="' . $item_class . '">';
        // blog thumbnail
        print_blog_thumbnail(get_the_ID(), $item_size);
        echo '<div class="blog-content-wrapper">';
        // blog title
        echo '<h2 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
        // blog information
        echo '<div class="blog-info-wrapper">';
        echo '<div class="blog-comment"><i class="icon-comments"></i>';
        comments_popup_link(__('0 Comment', 'gdl_front_end'), __('1 Comment', 'gdl_front_end'), __('% Comments', 'gdl_front_end'), '', __('Comment are off', 'gdl_front_end'));
        echo '</div>';
        echo '<div class="blog-author"><i class="icon-user"></i>';
        echo the_author_posts_link();
        echo '</div>';
        $tags_opening = '<div class="blog-tag"><i class="icon-tags"></i>';
        $tags_ending = '</div>';
        the_tags($tags_opening, ', ', $tags_ending);
        echo '<div class="clear"></div>';
        echo '</div>';
        // blog information
        // blog content
        echo '<div class="blog-content">';
        if ($full_content == "No") {
            if (get_post_type() == 'package') {
                echo do_shortcode(get_the_excerpt());
            } else {
                echo gdl_get_excerpt($num_excerpt, '... ');
            }
            echo '<div class="clear"></div>';
            echo '<a class="blog-continue-reading" href="' . get_permalink() . '"> ' . $translator_continue_reading . '</a>';
        } else {
            the_content($translator_continue_reading);
        }
        echo '</div>';
        echo '</div>';
        // blot content wrapper
        echo '</div>';
        // blog item
    }
}
示例#3
0
function print_blog_medium($item_class, $item_size, $num_excerpt, $full_content)
{
    global $gdl_admin_translator, $more, $gdl_date_format;
    if ($full_content == 'Yes') {
        $more = 0;
    }
    if ($gdl_admin_translator == 'enable') {
        $translator_continue_reading = get_option(THEME_SHORT_NAME . '_translator_continue_reading', 'Continue Reading');
    } else {
        $translator_continue_reading = __('Continue Reading ', 'gdl_front_end');
    }
    while (have_posts()) {
        the_post();
        echo '<div class="' . $item_class . '">';
        echo '<div class="blog-content-wrapper">';
        // blog thumbnail
        echo '<div class="blog-medium-media-wrapper">';
        print_blog_thumbnail(get_the_ID(), $item_size, true);
        echo '</div>';
        // blog-medium-media-wrapper
        echo '<div class="blog-context-wrapper">';
        // blog title
        echo '<h2 class="blog-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
        // blog content
        echo '<div class="blog-content">';
        if ($full_content == "No") {
            echo gdl_get_excerpt($num_excerpt, '... ');
        } else {
            the_content($translator_continue_reading);
        }
        echo '</div>';
        // blog information
        echo '<div class="blog-info-wrapper">';
        echo '<div class="blog-date">';
        echo '<span class="head">' . __('Posted On', 'gdl_front_end') . '</span> ';
        echo '<a href="' . get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '" >';
        echo get_the_time($gdl_date_format);
        echo '</a>';
        echo '</div>';
        echo '<div class="blog-author">';
        echo '<span class="separator">, </span>';
        echo '<span class="head">' . __('By', 'gdl_front_end') . '</span> ';
        echo the_author_posts_link();
        echo '</div>';
        echo '<div class="clear"></div>';
        echo '</div>';
        // blog information
        echo '</div>';
        // blog-context-wrapper
        echo '<div class="clear"></div>';
        echo '</div>';
        // blog-content-wrapper
        echo '</div>';
        // blog-item
    }
}
示例#4
0
function print_post_slider_item($item_xml)
{
    $num_fetch = find_xml_value($item_xml, 'num-fetch');
    $num_excerpt = find_xml_value($item_xml, 'num-excerpt');
    $show_caption = find_xml_value($item_xml, 'show-caption');
    $category = find_xml_value($item_xml, 'category', false);
    $category = $category == 'All' ? '' : $category;
    $postslider_xml = "<single-item><Post-Slider>";
    $postslider_xml = $postslider_xml . create_xml_tag('size', find_xml_value($item_xml, 'size'));
    $postslider_xml = $postslider_xml . create_xml_tag('width', find_xml_value($item_xml, 'width'));
    $postslider_xml = $postslider_xml . create_xml_tag('height', find_xml_value($item_xml, 'height'));
    $postslider_xml = $postslider_xml . create_xml_tag('slider-type', find_xml_value($item_xml, 'slider-type'));
    $postslider_xml = $postslider_xml . "<slider-item>";
    query_posts(array('post_type' => 'post', 'category_name' => $category, 'posts_per_page' => $num_fetch));
    while (have_posts()) {
        the_post();
        $postslider_xml = $postslider_xml . "<slider>";
        $postslider_xml = $postslider_xml . create_xml_tag('image', get_post_thumbnail_id(get_the_ID()));
        $postslider_xml = $postslider_xml . create_xml_tag('linktype', 'Link to URL');
        $postslider_xml = $postslider_xml . create_xml_tag('link', htmlspecialchars(get_permalink()));
        if ($show_caption == "Yes") {
            $postslider_xml = $postslider_xml . create_xml_tag('title', htmlspecialchars(get_the_title()));
            $postslider_xml = $postslider_xml . create_xml_tag('caption', htmlspecialchars(gdl_get_excerpt($num_excerpt)));
        }
        $postslider_xml = $postslider_xml . "</slider>";
    }
    $postslider_xml = $postslider_xml . "</slider-item>";
    $postslider_xml = $postslider_xml . "</Post-Slider></single-item>";
    $slider_xml_val = new DOMDocument();
    $slider_xml_val->loadXML($postslider_xml);
    foreach ($slider_xml_val->documentElement->childNodes as $slider_item_xml) {
        print_slider_item($slider_item_xml);
    }
    wp_reset_query();
}
示例#5
0
function print_medium_package($item_class, $item_size, $num_excerpt)
{
    global $gdl_admin_translator, $post, $gdl_date_format, $package_id;
    if ($gdl_admin_translator == 'enable') {
        $translator_learn_more = get_option(THEME_SHORT_NAME . '_translator_read_more_package', 'Learn More');
        $translator_book_now = get_option(THEME_SHORT_NAME . '_translator_book_now_package', 'Book Now!');
        $translator_last_minute = get_option(THEME_SHORT_NAME . '_translator_last_minute_package', 'Last Minute');
    } else {
        $translator_learn_more = __('Learn More', 'gdl_front_end');
        $translator_book_now = __('Book Now!', 'gdl_front_end');
        $translator_last_minute = __('Last Minute', 'gdl_front_end');
    }
    if (empty($package_id)) {
        $package_id = 0;
    }
    $contact_form = get_option(THEME_SHORT_NAME . '_booknow_contact_shortcode');
    if (!empty($contact_form)) {
        echo '<div class="book-now-contact hidden" id="gdl-booknow-' . $package_id . '">';
        echo do_shortcode($contact_form);
        echo '</div>';
    }
    while (have_posts()) {
        the_post();
        echo '<div class="' . $item_class . '">';
        $package_type = get_post_meta(get_the_ID(), 'package-type', true);
        if ($package_type == 'Last Minute') {
            $package_ribbon = 'last-minute';
            $package_type_text = '<span class="head">' . $translator_last_minute . '</span>';
            $package_type_text .= '<span class="discount-text">';
            $package_type_text .= get_post_meta(get_the_ID(), 'package-type-text', true);
            $package_type_text .= '</span>';
        } else {
            if ($package_type == 'None') {
                $package_ribbon = '';
                $package_type_text = '';
            } else {
                $package_ribbon = 'normal-type';
                $package_type_text = $translator_learn_more;
            }
        }
        // package thumbnail
        print_package_thumbnail(get_the_ID(), $item_size, $package_ribbon, $package_type_text);
        echo '<div class="package-content-wrapper">';
        // package title
        echo '<h2 class="package-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
        // package information
        $date_type = get_post_meta(get_the_ID(), 'package-date-type', true);
        if ($date_type == 'Fixed') {
            $start_date = get_post_meta(get_the_ID(), 'package-start-date', true);
            $end_date = get_post_meta(get_the_ID(), 'package-end-date', true);
            echo '<div class="package-date"><i class="icon-time"></i>';
            echo get_package_date($start_date, $end_date, $gdl_date_format);
            echo '</div>';
        } else {
            if ($date_type == 'Duration') {
                echo '<div class="package-date"><i class="icon-time"></i>';
                echo get_post_meta(get_the_ID(), 'package-duration', true);
                echo '</div>';
            }
        }
        // package content
        echo '<div class="package-content">';
        if (!empty($post->post_excerpt)) {
            echo do_shortcode(get_the_excerpt());
        } else {
            echo gdl_get_excerpt($num_excerpt, '... ');
        }
        echo '</div>';
        // package price
        if ($package_type == 'Learn More') {
            $price = get_post_meta(get_the_ID(), 'package-price', true);
            if (!empty($price)) {
                echo '<div class="package-info"><i class="icon-tag"></i>';
                echo '<span class="package-price">';
                echo do_shortcode($price);
                echo '</span>';
                echo '</div>';
            }
        } else {
            if ($package_type == 'Last Minute') {
                $price = get_post_meta(get_the_ID(), 'package-price', true);
                if (!empty($price)) {
                    echo '<div class="package-info last-minute"><i class="icon-tag"></i>';
                    echo '<span class="normal-price">';
                    echo do_shortcode($price);
                    echo '</span>';
                    echo '<span class="discount-price">';
                    echo get_post_meta(get_the_ID(), 'package-last-minute-widget-text', true);
                    echo '</span>';
                    echo '</div>';
                    //package-info-inner
                }
            }
        }
        // book now button
        if (!empty($contact_form)) {
            echo '<a class="package-book-now-button gdl-button large various" ';
            echo ' href="#gdl-booknow-' . $package_id . '" data-fancybox-type="inline" data-rel="fancybox" ';
            echo ' data-title="' . get_the_title() . '" data-url="' . get_permalink() . '" >';
            echo $translator_book_now;
            echo '</a>';
        }
        echo '</div>';
        // blog-context-wrapper
        echo '<div class="clear"></div>';
        echo '</div>';
        // package-item
    }
    $package_id++;
}
示例#6
0
function print_page_item($item_xml)
{
    print_item_header(find_xml_value($item_xml, 'header'), '', '', find_xml_value($item_xml, 'icon-class'));
    global $paged, $gdl_element_id, $port_div_size_num_class, $sidebar_type;
    if (empty($paged)) {
        $paged = get_query_var('page') ? get_query_var('page') : 1;
    }
    // get the page meta value
    $port_size = find_xml_value($item_xml, 'item-size');
    $item_size = $port_div_size_num_class[$port_size][$sidebar_type];
    $num_fetch = find_xml_value($item_xml, 'num-fetch');
    $num_excerpt = find_xml_value($item_xml, 'num-excerpt');
    query_posts(array('post_type' => 'page', 'paged' => $paged, 'orderby' => 'menu_order', 'order' => 'asc', 'post_parent' => get_the_ID(), 'posts_per_page' => $num_fetch));
    echo '<div class="portfolio-item-holder row">';
    while (have_posts()) {
        the_post();
        print_item_size($port_size, 0.1, 'portfolio-item mb40');
        $thumbnail_id = get_post_thumbnail_id();
        if (!empty($thumbnail_id)) {
            $thumbnail = wp_get_attachment_image_src($thumbnail_id, $item_size);
            $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
            echo '<div class="portfolio-media-wrapper gdl-image">';
            echo '<a class="hover-wrapper" href="' . get_permalink() . '" >';
            echo '<span class="portfolio-thumbnail-image-hover">';
            echo '<span class="hover-link"></span>';
            echo '</span>';
            echo '</a>';
            echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>';
            echo '</div>';
            //portfolio thumbnail image
        }
        $show_title = find_xml_value($item_xml, "show-title") == "Yes" ? true : false;
        $show_excerpt = find_xml_value($item_xml, "show-excerpt") == "Yes" ? true : false;
        if ($show_title || $show_excerpt) {
            echo '<div class="page-context">';
            if ($show_title) {
                echo '<h2 class="page-item-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>';
            }
            if ($show_excerpt) {
                echo '<div class="page-item-content">' . gdl_get_excerpt($num_excerpt) . '</div>';
            }
            echo '</div>';
            // port-thumbnail-contxt
        }
        echo '<div class="clear"></div>';
        echo '</div>';
        // close print_item_size
    }
    echo "</div>";
    // portfolio-item-holder
    echo '<div class="clear"></div>';
    if (find_xml_value($item_xml, "pagination") == "Yes") {
        pagination();
    }
    wp_reset_query();
}
    function widget($args, $instance)
    {
        global $gdl_widget_date_format, $blog_full_widget_size;
        extract($args);
        $title = apply_filters('widget_title', $instance['title']);
        $post_cat = $instance['post_cat'];
        $show_num = $instance['show_num'];
        $num_excerpt = $instance['num_excerpt'];
        if ($post_cat == "All") {
            $post_cat = '';
        }
        // Opening of widget
        echo $before_widget;
        // Open of title tag
        if ($title) {
            echo $before_title . $title . $after_title;
        }
        // Widget Content
        $current_post = array(get_the_ID());
        query_posts(array('showposts' => $show_num, 'category_name' => $post_cat, 'post__not_in' => $current_post));
        if (have_posts()) {
            echo "<div class='gdl-full-post-widget'>";
            while (have_posts()) {
                the_post();
                ?>
				<div class="full-post-widget">
					<?php 
                $thumbnail_id = get_post_thumbnail_id(get_the_ID());
                $thumbnail = wp_get_attachment_image_src($thumbnail_id, $blog_full_widget_size);
                if ($thumbnail_id) {
                    echo '<div class="full-post-widget-thumbnail">';
                    echo '<a href="' . get_permalink() . '">';
                    $alt_text = get_post_meta($thumbnail_id, '_wp_attachment_image_alt', true);
                    if (!empty($thumbnail)) {
                        echo '<img src="' . $thumbnail[0] . '" alt="' . $alt_text . '"/>';
                    }
                    echo '</a>';
                    echo '<div class="blog-comment"><i class="icon-comments"></i>';
                    comments_popup_link(__('0', 'gdl_front_end'), __('1', 'gdl_front_end'), __('%', 'gdl_front_end'), '', __('Off', 'gdl_front_end'));
                    echo '</div>';
                    echo '</div>';
                }
                ?>
					
					<div class="full-post-widget-context">
						<h4 class="full-post-widget-title">
							<a href="<?php 
                echo get_permalink();
                ?>
"> 
								<?php 
                echo get_the_title();
                ?>
 
							</a>
						</h4>
						<div class="full-post-widget-excerpt">
							<?php 
                echo gdl_get_excerpt($num_excerpt);
                ?>
						</div>
						<div class="full-post-widget-info">
							<div class="full-post-widget-date">
								<?php 
                echo __('Posted On', 'gdl_front_end') . ' ';
                echo get_the_time($gdl_widget_date_format);
                ?>
							</div>						
						</div>
					</div>
					<div class="clear"></div>
				</div>						
				<?php 
            }
            echo "</div>";
        }
        // Closing of widget
        echo $after_widget;
        wp_reset_query();
    }