Exemplo n.º 1
0
function lip_love_it_link($post_id = null, $link_text = null, $already_loved = null, $echo = true)
{
    global $current_user;
    global $app_url;
    $app_url = get_bloginfo('url');
    //	$already_loved = __('You have already liked this', 'love_it');
    global $user_ID, $post;
    if (is_null($post_id)) {
        $post_id = $post->ID;
    }
    $love_count = lip_get_love_count($post_id);
    ob_start();
    if (!lip_user_has_loved_post($user_ID, $post_id)) {
        echo '<a ';
        if (!is_user_logged_in()) {
            echo 'href="#" ';
        }
        echo ' title="You can like this content, but the action won&#39;t be recorded in your profile unless you&#39re signed in." id="likethis" class="love-it nh-btn-blue" data-post-id="' . $post_id . '" data-user-id="' . $user_ID . '">Like this</a>';
    } else {
        // Seems to duplicate php if/else on page ??
        echo '<a id="likedthis" title="See your other Likes" href="' . $app_url . '/author/' . $current_user->user_login . '" class="likedthis nhline">You like this</a>';
    }
    if ($echo) {
        echo apply_filters('lip_links', ob_get_clean());
    } else {
        return apply_filters('lip_links', ob_get_clean());
    }
}
function lip_love_it_nolink($post_id = null, $link_text, $already_loved, $echo = true)
{
    global $user_ID, $post;
    if (is_null($post_id)) {
        $post_id = $post->ID;
    }
    // retrieve the total love count for this item
    $love_count = lip_get_love_count($post_id);
    ob_start();
    // our wrapper DIV
    echo '<div class="love-it-wrapper">';
    // show a message to users who have already loved this item
    echo '<span class="loved">' . $already_loved . ' <span class="love-count">' . $love_count . '</span></span>';
    // close our wrapper DIV
    echo '</div>';
    if ($echo) {
        echo apply_filters('lip_links', ob_get_clean());
    } else {
        return apply_filters('lip_links', ob_get_clean());
    }
}
Exemplo n.º 3
0
function get_posts_slider()
{
    global $post, $wp_query;
    $output = '';
    $options = get_option('sf_flexform_options');
    $posts_slider_type = get_post_meta($post->ID, 'sf_posts_slider_type', true);
    $posts_category = get_post_meta($post->ID, 'sf_posts_slider_category', true);
    $portfolio_category = get_post_meta($post->ID, 'sf_posts_slider_portfolio_category', true);
    $count = get_post_meta($post->ID, 'sf_posts_slider_count', true);
    $args = array();
    if ($posts_slider_type == "post") {
        $category_list = get_category_list('category');
        $slider_category = $category_list[$posts_category];
        if ($slider_category == "All") {
            $slider_category = "all";
        }
        if ($slider_category == "all") {
            $slider_category = '';
        }
        $category_slug = str_replace('_', '-', $slider_category);
        $args = array('post_type' => 'post', 'post_status' => 'publish', 'category_name' => $category_slug, 'posts_per_page' => $count);
    } else {
        if ($posts_slider_type == "hybrid") {
            $args = array('post_type' => array('post', 'portfolio'), 'post_status' => 'publish', 'posts_per_page' => $count);
        } else {
            $category_list = get_category_list('portfolio-category');
            $slider_category = $category_list[$portfolio_category];
            if ($slider_category == "All") {
                $slider_category = "all";
            }
            if ($slider_category == "all") {
                $slider_category = '';
            }
            $category_slug = str_replace('_', '-', $slider_category);
            $args = array('post_type' => 'portfolio', 'post_status' => 'publish', 'portfolio-category' => $category_slug, 'posts_per_page' => $count);
        }
    }
    $slider_items = new WP_Query($args);
    if ($slider_items->have_posts()) {
        $output .= '<!--// SWIFT SLIDER //-->' . "\n";
        $output .= '<div id="swift-slider" class="flexslider">' . "\n";
        $output .= '<div class="swift-slider-loading"></div>' . "\n";
        $output .= '<ul class="slides">' . "\n";
        while ($slider_items->have_posts()) {
            $slider_items->the_post();
            $post_title = get_the_title();
            $post_permalink = get_permalink();
            $post_author = get_the_author_link();
            $post_date = get_the_date();
            $post_client = get_post_meta($post->ID, 'sf_portfolio_client', true);
            $post_categories = get_the_category_list(', ');
            if ($posts_slider_type == "portfolio") {
                $post_categories = get_the_term_list($post->ID, 'portfolio-category', '', ', ');
            }
            $post_comments = get_comments_number();
            $custom_excerpt = get_post_meta($post->ID, 'sf_custom_excerpt', true);
            $post_excerpt = '';
            if ($custom_excerpt != '') {
                $post_excerpt = custom_excerpt($custom_excerpt, 20);
            } else {
                $post_excerpt = excerpt(20);
            }
            $posts_slider_image = rwmb_meta('sf_posts_slider_image', 'type=image&size=full');
            $caption_position = get_post_meta($post->ID, 'sf_caption_position', true);
            $accent_color = get_option('accent_color', '#fb3c2d');
            $secondary_accent_color = get_option('secondary_accent_color', '#2e2e36');
            $secondary_accent_alt_color = get_option('secondary_accent_alt_color', '#ffffff');
            $media_image_url = "";
            foreach ($posts_slider_image as $detail_image) {
                $media_image_url = $detail_image['url'];
                break;
            }
            if (!$posts_slider_image) {
                $posts_slider_image = get_post_thumbnail_id();
                $media_image_url = wp_get_attachment_url($posts_slider_image, 'full');
            }
            if (!$caption_position) {
                $caption_position = "caption-right";
            }
            $image = aq_resize($media_image_url, 1920, NULL, true, false);
            $output .= '<li>' . "\n";
            $output .= '<div class="slide-caption-container">' . "\n";
            if ($image) {
                $output .= '<div class="flex-caption ' . $caption_position . '">' . "\n";
                $output .= '<div class="flex-caption-details">' . "\n";
                $output .= '<div class="caption-details-inner">' . "\n";
                $output .= '<div class="details clearfix">' . "\n";
                $output .= '<span class="date">' . $post_date . '</span>' . "\n";
                if ($post_client != "") {
                    $output .= '<span class="item-client">' . __("Client: ", "swiftframework") . $post_client . '</span>' . "\n";
                    $output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
                } else {
                    $output .= '<span class="item-author">' . __("Posted by ", "swiftframework") . $post_author . '</span>' . "\n";
                    $output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
                }
                $output .= '</div>';
                if (comments_open()) {
                    $output .= '<div class="comment-chart chart" data-percent="1" data-count="' . $post_comments . '" data-barcolor="' . $secondary_accent_color . '"><span>0</span><i class="icon-comments"></i></div>' . "\n";
                }
                if (function_exists('lip_get_love_count')) {
                    $output .= '<div class="loveit-chart chart" data-percent="1" data-count="' . lip_get_love_count($post->ID) . '" data-barcolor="' . $accent_color . '"><span>0</span><i class="icon-heart"></i></div>' . "\n";
                }
                $output .= '</div>' . "\n";
                $output .= '</div>' . "\n";
                $output .= '<div class="flex-caption-headline clearfix">' . "\n";
                $output .= '<h4><a href="' . $post_permalink . '"><span>' . $post_title . '</span><i class="icon-angle-right"></i></a></h4>' . "\n";
                $output .= '</div></div></div>' . "\n";
                $output .= '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" alt="' . $post_title . '" />' . "\n";
            } else {
                $output .= '<div class="flex-caption-large clearfix">' . "\n";
                $output .= '<h1><a href="' . $post_permalink . '">' . $post_title . '</a></h1>' . "\n";
                $output .= '<div class="excerpt">' . $post_excerpt . '</div>' . "\n";
                $output .= '<div class="cl-charts">' . "\n";
                if (comments_open()) {
                    $output .= '<div class="comment-chart fw-chart chart" data-percent="1" data-count="' . $post_comments . '" data-barcolor="' . $secondary_accent_alt_color . '"><span>0</span><i class="icon-comments"></i></div>' . "\n";
                }
                if (function_exists('lip_get_love_count')) {
                    $output .= '<div class="loveit-chart fw-chart chart" data-percent="1" data-count="' . lip_get_love_count($post->ID) . '" data-barcolor="' . $accent_color . '"><span>0</span><i class="icon-heart"></i></div>' . "\n";
                }
                $output .= '</div>' . "\n";
                $output .= '<div class="details clearfix">' . "\n";
                $output .= '<span class="date">' . $post_date . '</span>' . "\n";
                if ($post_client != "") {
                    $output .= '<span class="item-client">' . __("Client: ", "swiftframework") . $post_client . '</span>' . "\n";
                    $output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
                } else {
                    $output .= '<span class="item-author">' . __("Posted by ", "swiftframework") . $post_author . '</span>' . "\n";
                    $output .= '<span class="item-categories">' . $post_categories . '</span>' . "\n";
                }
                $output .= '</div></div></div>' . "\n";
            }
            $output .= '</li>' . "\n";
        }
        wp_reset_postdata();
        $output .= '</ul></div>' . "\n";
    }
    echo $output;
}
Exemplo n.º 4
0
					</div>
				</div><!--/ tab2-->
				
				<div class="tab-pane tab-pane-author" id="tab3">
					<div class="author-posts">
<?php 
$likes = get_user_meta($curauth->ID, 'nh_li_user_loves');
foreach ($likes as $like) {
    $tmp = count($like);
    for ($i = 0; $i < $tmp; $i++) {
        $nh_post_id = $like[$i];
        $nh_post_status = get_post_status($nh_post_id);
        if ($nh_post_status == "publish") {
            $post_title = get_the_title($nh_post_id);
            $post_url = get_permalink($nh_post_id);
            $post_like_count = lip_get_love_count($nh_post_id);
            echo '<p class="author-list"><a class="nhline" href="' . $post_url . '" title="View ' . $post_title . '">';
            echo $post_title . '</a>';
            echo '&nbsp;&nbsp;<span class="meta">(' . $post_like_count . ' <span class="byline">';
            if ($post_like_count == '1') {
                echo 'person ';
            } else {
                echo 'people ';
            }
            echo 'like this</span>';
            echo ')</span></p>';
        }
    }
}
if (!$likes and $current_user->ID == $curauth->ID) {
    echo '<h5>You haven&#39;t liked anything yet!</h5>';
Exemplo n.º 5
0
    			$city_string .= '<a class="nhline" href="'.$app_url.'/cities/'.$post_city->slug.'" title="See all content for '.$city.'">'.$city_name.'</a>, ';
    		}
    	}
    	echo rtrim($city_string, ', ');
    }
    */
    ?>
					
				</p>	
				<ul class="gde-meta">
					<li><img src="<?php 
    echo $style_url;
    ?>
/lib/timthumb.php?src=/images/icons/heart.png&h=14&zc=1&at=t" alt="Number of likes"> 
<?php 
    $tmp = lip_get_love_count($post->ID);
    echo '<span class="nh-love-count">' . $tmp . '</span>';
    ?>
					</li>
<?php 
    if (have_comments()) {
        echo '<li>';
        echo '<img src="' . $style_url . '/lib/timthumb.php?src=/images/icons/comment.png&h=16&zc=1&at=t" alt="Number of comments"> ';
        comments_number('', '1', '%');
        echo '</li>';
    }
    ?>
					<li><img src="<?php 
    echo $style_url;
    ?>
/lib/timthumb.php?src=/images/icons/eyeball.png&h=14&zc=1&at=t" alt="Number of views"> <?php