function vote($atts, $content = null) { esc_attr(extract(shortcode_atts(array('title' => '', 'cb_vote_id' => ''), $atts))); ob_start(); echo '<div class="vote_block"><div id="vote_btn_' . $cb_vote_id . '">'; show_vote_button($cb_vote_id, check_votes($cb_vote_id), 'post-page', 'vote_btn_' . $cb_vote_id); echo '</div></div>'; $return_html = ob_get_contents(); ob_end_clean(); return apply_filters('vote', $return_html); }
function cbvote_code() { check_ajax_referer('getrends-settings', 'security'); $data = $_POST; unset($data['security'], $data['action']); if (isset($data['postID'])) { $postID = $data['postID']; } if (isset($data['type'])) { $type = $data['type']; } if (isset($data['conID'])) { $conID = $data['conID']; } $old = get_post_meta($postID, 'cb_vote_nb_vote', true); if (!$old || !is_numeric($old)) { $old = 0; } $user_id = get_current_user_id(); $my_ip = getenv("REMOTE_ADDR"); if ($user_id == 0) { $value = $my_ip; } else { $value = $user_id; } add_post_meta($postID, 'cb_vote_users_vote', $value); $old_cb_vote_details = get_post_meta($postID, 'cb_vote_details', true); $poddata = array('IP' => $value, 'time' => time()); $old_cb_vote_details[] = $poddata; update_post_meta($postID, 'cb_vote_details', $old_cb_vote_details); update_post_meta($postID, 'cb_vote_nb_vote', $old + 1); ob_start(); show_vote_button($postID, check_votes($postID), 'done', $conID); $data = ob_get_contents(); ob_end_clean(); die($data); }
function cb_loader_code() { check_ajax_referer('dayandnight-settings', 'security'); $data = $_POST; unset($data['security'], $data['action']); if (isset($data['cats'])) { $cats = $data['cats']; } if (isset($data['typ'])) { $typ = $data['typ']; } else { $typ = 'port'; } if (isset($data['con_lg'])) { $con_lg = $data['con_lg']; } else { $con_lg = '100'; } if (isset($data['per_page'])) { $per_page = $data['per_page']; } if (isset($data['paged'])) { $paged = $data['paged']; } if (isset($data['col_v'])) { $col_v = $data['col_v']; } if (isset($data['columns'])) { $columns = $data['columns']; } if (isset($data['pcap'])) { $pcap = $data['pcap']; } if (isset($data['headi'])) { $headi = $data['headi']; } if (isset($data['headi_end'])) { $headi_end = $data['headi_end']; } if (isset($data['plink'])) { $plink = $data['plink']; } if (isset($data['pshape'])) { $pshape = $data['pshape']; } if (isset($data['fr'])) { $fr = $data['fr']; } if (isset($data['frin'])) { $frin = $data['frin']; } if (isset($data['pheight'])) { $pheight = $data['pheight']; } if (isset($data['roundy'])) { $roundy = $data['roundy']; } if (isset($data['bfi_w'])) { $bfi_w = $data['bfi_w']; } else { $bfi_w = ''; } if (isset($data['det'])) { $det = $data['det']; } else { $det = 'no'; } ob_start(); ?> <div class="<?php if ($typ == 'blog') { echo 'blog_els'; } else { echo 'port_els'; } ?> "> <?php $cc = 1; query_posts('cat=' . $cats . '&posts_per_page=' . $per_page . '&paged=' . $paged); if (have_posts()) { while (have_posts()) { the_post(); ?> <?php global $post; $output = ''; $ccat = ''; $c_cat = get_the_category(); foreach ($c_cat as $c_cat_item) { $output .= ' cat-' . $c_cat_item->term_id; $ccat .= $c_cat_item->term_id; } $headi = str_replace('/', '', $headi); ?> <div class="<?php if ($typ == 'blog') { echo 'postbox blog_item post-cat'; } else { echo 'pitem'; } ?> <?php echo $col_v; ?> <?php echo $output; ?> " data-id="<?php echo $ccat; ?> " style="<?php if ($columns != 1 && $cc % $columns == 0 && $cc != 0) { echo 'margin-right: 0;'; } ?> "> <?php if ($typ == 'blog') { ?> <div class="<?php if (has_post_format('quote')) { echo 'post_quote'; } if (has_post_format('link')) { echo 'post_link'; } if (has_post_format('gallery')) { echo 'post_gallery'; } ?> ddd blog_inside_post"> <?php } ?> <?php $isrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $imgs = get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID); if ($isrc == '') { $isrc = wp_get_attachment_image_src(array_shift(array_keys($imgs)), 'full'); } $bfi_var = ''; if ($pshape == '' || $pshape == 'rectangle' || $pshape == 'default') { $bfi_var = bfi_thumb($isrc[0], array('width' => $bfi_w, 'height' => $bfi_w, 'crop' => true)); } else { $bfi_var = bfi_thumb($isrc[0], array('width' => $bfi_w, 'height' => $bfi_w, 'crop' => true)); } $pshapediv = ''; $pshapecon = ''; if ($pcap == 'yes') { $nocap = ''; } else { $nocap = ' nocap'; } if ($pcap == 'yes') { $pcapy = ''; } else { $pcapy = ''; } $see_more = __('see more', 'cb-getrends'); if ($plink == 'ajax') { $picons = '<div class="see_more_wrap"><div class="see_wrap2"><a data-cur-id="' . $post->ID . '" onclick="load_image(\'' . $isrc[0] . '\',\'' . $post->ID . '\');return false;" href="' . $isrc[0] . '"><span class="arr_wrap"><img src="' . WP_THEME_URL . '/img/icons/arr_r.png" class="fade-s fade_arr_r" alt="' . $see_more . '"/></span><h1><span class="fade_see">' . $see_more . '</span></h1></a></div></div><div class="cl"></div>'; } else { $picons = '<div class="see_more_wrap"><div class="see_wrap2"><a href="' . $isrc[0] . '" data-rel="pp[ppgall]"><span class="arr_wrap"><img src="' . WP_THEME_URL . '/img/icons/arr_r.png" class="fade-s fade_arr_r" alt="' . $see_more . '"/></span><h1><span class="fade_see">' . $see_more . '</span></h1></a></div></div><div class="cl"></div>'; } if ($plink == 'page') { $picons = '<div class="see_more_wrap"><div class="see_wrap2"><a href="' . get_permalink() . '"><span class="arr_wrap"><img src="' . WP_THEME_URL . '/img/icons/arr_r.png" class="fade-s fade_arr_r" alt="' . $see_more . '"/></span><h1><span class="fade_see">' . $see_more . '</span></h1></a></div></div><div class="cl"></div>'; } if ($pshape != '' && $pshape != 'default' && $pshape != 'rectangle') { $pshapediv = '<div class="pshape-' . $pshape . '"></div>'; $fadec1 = ''; $fadec2 = '<div class="fade_c">' . $picons . $pcapy . '</div>'; $pshapecon = 'portfolio-shape' . $nocap; } else { $pshapediv = ''; $fadec1 = '<div class="fade_c">' . $pcapy . $picons . '</div>'; $fadec2 = ''; $pshapecon = ''; } if ($isrc) { ?> <div class="<?php echo $fr; ?> <?php echo $roundy; ?> fade fade_ajax <?php echo $pshapecon; ?> "> <div class="<?php echo $frin; ?> <?php echo $roundy; ?> "> <?php echo $fadec1; ?> <?php echo $pshapediv . $fadec2; ?> <a <?php if ($plink == 'ajax') { ?> data-cur-id="<?php echo $post->ID; ?> " onclick="load_image('<?php echo $isrc[0]; ?> ','<?php echo $post->ID; ?> ');return false;" <?php } ?> href="<?php if ($plink == 'page') { echo get_permalink(); } else { echo $isrc[0]; } ?> " <?php if ($plink == 'image') { echo 'data-rel="pp"'; } ?> ><img src="<?php echo $bfi_var; ?> " class="<?php echo $roundy; ?> fade fade_ajax" alt="portfolio item" /> </a> <div class="cl"></div> </div> <?php if ($typ == 'blog') { ?> <div class="titlo"> <?php $cb_get_votes = check_votes($post->ID); $vot = $cb_get_votes['votes']; $voty = '<span class="vote">' . __('Votes', 'cb-getrends') . ': ' . $vot . '</span>'; if ($cb_get_votes['state'] == '0') { $voty = ''; } $datee = ' <h3 class="date_title skin-text">' . $voty . '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link">' . get_avatar(get_the_author_meta('ID'), 32) . get_the_author() . '</a> <i class="icon-time"></i> ' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . '</h3>'; if ($coll != '1') { echo $headi . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . $headi_end; } else { echo '<h1 class="mbimp blog_title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1>'; } if ($coll != '1') { echo $datee; } else { echo ' <h3 class="date_title skin-text"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link">' . get_avatar(get_the_author_meta('ID'), 32) . get_the_author() . '</a> <i class="icon-time"></i> ' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . ''; $tags = ''; $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { if ($tag->name != '') { $tags .= '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->name . '</a> '; } } } if ($tags != '') { echo '<span class="tags"><i class="icon-tags"></i> ' . $tags . '</span>'; $tags = ''; } echo '<span class="comments"><i class="icon-comments"></i> '; echo comments_number('0 Comments', '1 Comments', '% Comments'); echo '</span>'; $categories = get_the_category(); $output = ''; echo '<span class="cats">'; foreach ($categories as $category) { $output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'cb-getrends'), $category->name)) . '">' . $category->cat_name . '</a>, '; } echo '<i class="icon-folder-open"></i> Posted in: ' . substr(trim($output), 0, -1) . '</span>'; echo '</h3>'; } ?> </div><?php } ?> <?php if ($det == 'yes' || $typ == 'blog') { $pcatso = ''; if ($typ == 'blog') { echo '<div class="recent_inside">'; } else { echo '<div class="portfolio_det">'; } $categoriesy = wp_get_post_categories($post->ID); foreach ($categoriesy as $cate) { $category = get_category($cate); $pcatso .= '<a href="' . get_category_link($category->term_id) . '" class="skin-text" title="' . esc_attr(sprintf(__("View all posts in %s", 'cb-getrends'), $category->name)) . '">' . $category->cat_name . '</a>, '; } $pcatso = substr($pcatso, 0, -2); if ($typ != blog) { echo $headi . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . $headi_end; if ($typ == 'blog') { echo ' <h3 class="date_title skin-text"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link">' . get_avatar(get_the_author_meta('ID'), 32) . get_the_author() . '</a> <i class="icon-time"></i> ' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . ''; echo '</h3>'; } else { echo '<span class="port_author skin-text">by: <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link skin-text">' . get_the_author() . '</a></span>'; echo '<span class="port_date skin-text">' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . '</span> / <span class="port_cats skin-text">' . $pcatso . '</span>'; } } if ($typ == 'blog') { ?> <p> <?php $con = get_the_content(); echo strip_cn($con, $con_lg); ?> </p> <?php } } ?> </div> </div> <?php } else { ?> <?php if ($typ != 'blog') { ?> <div class="<?php echo $fr; ?> <?php echo $roundy; ?> "> <div class="<?php echo $frin; ?> round"> <a href="<?php echo get_permalink(); ?> "><img src="<?php echo bfi_thumb(WP_THEME_URL . '/img/test_bg.jpg', array('width' => 1170, 'height' => 950, 'crop' => true)); ?> " class="<?php echo $roundy; ?> fade fade_ajax" alt="no image" /> </a> <div class="cl"></div> </div> <?php } ?> <?php if ($det == 'yes' || $typ == 'blog') { $pcatso = ''; if ($typ == 'blog') { echo '<div class="recent_inside">'; } else { echo '<div class="portfolio_det">'; } $categoriesy = wp_get_post_categories($post->ID); foreach ($categoriesy as $cate) { $category = get_category($cate); $pcatso .= '<a href="' . get_category_link($category->term_id) . '" class="skin-text" title="' . esc_attr(sprintf(__("View all posts in %s", 'cb-getrends'), $category->name)) . '">' . $category->cat_name . '</a>, '; } $pcatso = substr($pcatso, 0, -2); echo $headi . '<a href="' . get_permalink() . '">' . get_the_title() . '</a>' . $headi_end; if ($typ == 'blog') { echo ' <h3 class="date_title skin-text"><a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link">' . get_avatar(get_the_author_meta('ID'), 32) . get_the_author() . '</a> <i class="icon-time"></i> ' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . ''; echo '</h3>'; } else { echo '<span class="port_author skin-text">by: <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" class="author_link skin-text">' . get_the_author() . '</a></span>'; echo '<span class="port_date skin-text">' . get_the_time('M') . ' ' . get_the_time('j') . ', ' . get_the_time('Y') . '</span> / <span class="port_cats skin-text">' . $pcatso . '</span>'; } if ($typ == 'blog') { ?> <p> <?php $con = get_the_content(); echo strip_cn($con, $con_lg); ?> </p> <?php } } ?> </div> </div> <?php } ?> <?php if ($typ != 'blog') { ?> <div class="port_item port_<?php echo $post->ID; ?> "> <?php echo '<h1 class="title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h1>'; ?> <?php echo get_the_content(); ?> <?php $port_url = get_post_meta($post->ID, 'cb4_port_url', 'true'); $port_client = get_post_meta($post->ID, 'cb4_port_client', 'true'); $port_key = get_post_meta($post->ID, 'cb4_port_key', 'true'); echo '<ul>'; if ($port_url != '') { echo '<li><b>' . __('Project URL') . '</b>: <a href="' . $port_url . '" target="_blank">' . $port_url . '</a></li>'; } if ($port_client != '') { echo '<li><b>' . __('Project Client') . '</b>: ' . $port_client . '</li>'; } if ($port_key != '') { echo '<li><b>' . __('Keywords') . '</b>: <i>' . $port_key . '</i></li>'; } echo '</ul>'; echo '<div class="port_arrows"><a class="cb-next-porfolio prev-arrow" data-me-id="' . $post->ID . '" data-action="prev">« ' . __('previous item', 'cb-getrends') . '</a><a class="cb-next-porfolio next-arrow" data-me-id="' . $post->ID . '" data-action="next">' . __('next item', 'cb-getrends') . ' »</a></div>'; ?> </div> <div class="c_item c_item_<?php echo $post->ID; ?> " style="display: none;"> <a href="#" class="prev_item">« <?php _e('prev item', 'cb-getrends'); ?> </a> <a href="#" class="next_item"><?php _e('next item', 'cb-getrends'); ?> »</a> </div> <?php } ?> <div class="cl"></div> <?php if ($typ == 'blog') { ?> </div> <?php } ?> </div> <!--/portfolio post end--> <?php $cc++; } } wp_reset_query(); ?> <div class="cl"></div> </div> <div class="cl"></div> <?php $data = ob_get_contents(); ob_end_clean(); die($data); }
echo '<div class="cl"></div>'; if ($pin != '') { echo '<a href="' . $pin . '" target="_blank"><i class="icon-pinterest transi"></i></a>'; } if ($fb != '') { echo '<a href="' . $fb . '" target="_blank"><i class="icon-facebook transi"></i></a>'; } if ($tw != '') { echo '<a href="' . $tw . '" target="_blank"><i class="icon-twitter transi"></i></a>'; } ?> <div class="cl"></div> </div> <div class="vote_now rounder"> <?php $cb_get_votes = check_votes($post->ID); /* show vote button functions.php:783*/ echo '<div id="vote_btn_' . $post->ID . '">'; show_vote_button($post->ID, $cb_get_votes, 'post-page', 'vote_btn_' . $post->ID); echo '</div>'; ?> </div> <div class="vote_excerpt"> <?php echo get_the_excerpt(); ?> </div> </div> <?php