function pmc_portBlock($title, $number_post, $rowsB, $categories, $port_ajax) { wp_enqueue_script('pmc_bxSlider'); $rand = rand(0, 99); global $pmc_data, $sitepress; if (isset($pmc_data['home_recent_number_post'])) { $showpost = $pmc_data['home_recent_number_post']; } else { $showpost = 3; } if ($number_post) { $showpost = $number_post; } if ($title) { $title = $title; } else { $title = pmc_stripText($pmc_data['translation_port']); } if (isset($pmc_data['home_recent_number_display'])) { $rows = $pmc_data['home_recent_number_display']; } else { $rows = 3; } if ($rowsB) { $rows = $rowsB; } if (isset($categories) and count($categories) > 0) { $categories = $categories; $pc = new WP_Query(array('post_type' => $pmc_data['port_slug'], 'tax_query' => array(array('taxonomy' => 'portfoliocategory', 'field' => 'id', 'terms' => $categories)), 'posts_per_page' => $number_post)); } else { $categories = ''; $pc = new WP_Query(array('post_type' => $pmc_data['port_slug'], 'posts_per_page' => $number_post)); } ?> <script type="text/javascript"> jQuery(document).ready(function(){ // Slider var $slider = jQuery('#sliderAdvertisePort').bxSlider({ controls: true, displaySlideQty: 1, default: 1000, easing : 'easeInOutQuint', prevText : '', nextText : '', pager :false }); }); </script> <?php if ($pc->have_posts()) { wp_enqueue_script('pmc_any'); wp_enqueue_script('pmc_any_fx'); wp_enqueue_script('pmc_any_video'); ?> <div class="homerecent"> <div class="homerecentInner"> <div id = "showpost-<?php echo $pmc_data['port_slug']; ?> -<?php echo $rand; ?> "> <div class="showpostload"><div class="loading"></div></div> <div class = "closehomeshow-<?php echo $pmc_data['port_slug']; ?> port closeajax"><i class="icon-remove"></i></div> <div class="showpostpostcontent"></div> </div> <div class="titlebordrtext"><h2 class="titleborderh2"><?php echo $title; ?> </h2></div> <div class="titleborderOut"><div class="titleborder"></div></div> <ul id="sliderAdvertisePort" class="sliderAdvertisePort"> <?php $currentindex = ''; $count = 1; $countitem = 1; $type = $pmc_data['port_slug']; ?> <?php while ($pc->have_posts()) { $pc->the_post(); if ($countitem == 1) { echo '<li>'; } $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'homePort', false); $catType = 'portfoliocategory'; //category $categoryIn = get_the_term_list(get_the_ID(), $catType, '', ', ', ''); $category = explode(',', $categoryIn); //end category if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'homePort', false); $image = $image[0]; $imagefull = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full', false); $imagefull = $imagefull[0]; } else { $image = get_template_directory_uri() . '/images/placeholder-portfolio-home.png'; } if ($count != 3) { echo '<div class="one_third" >'; } else { echo '<div class="one_third last" >'; $count = 0; } ?> <?php if ($port_ajax == 'true') { ?> <div class="click" id="<?php echo $type; ?> _<?php echo get_the_id(); ?> _<?php echo $rand; ?> "> <?php } ?> <?php if ($port_ajax != 'true') { ?> <a href = "<?php echo $imagefull; ?> " title="<?php echo esc_attr(get_the_title(get_the_id())); ?> " rel="lightbox" > <?php } ?> <div class="recentimage"> <div class="overdefult"> <div class="portIcon"></div> </div> <div class="image"> <div class="loading"></div> <img class="portfolio-home-image" src="<?php echo $image; ?> " alt="<?php the_title(); ?> "> </div> </div> <?php if ($port_ajax != 'true') { ?> </a> <?php } ?> <div class="recentdescription"> <?php if ($port_ajax != 'true') { ?> <a href="<?php echo get_permalink(get_the_id()); ?> "> <?php } ?> <h3><?php $title = the_title('', '', FALSE); echo substr($title, 0, 23); if (strlen($title) > 23) { echo '...'; } ?> </h3> <?php if ($port_ajax != 'true') { ?> </a> <?php } ?> <div class="recentdescription-text"><?php echo shortcontent("[", "]", "", get_the_content(), 90); ?> </div> <?php if ($port_ajax != 'true') { ?> <div class="recentdescription-text"><a href="<?php echo get_permalink(get_the_id()); ?> "><?php echo pmc_translation('translation_morelinkblog', 'Read more about this...'); ?> </a></div> <?php } ?> </div> <?php if ($port_ajax == 'true') { ?> </div> <?php } ?> </div> <?php $count++; if ($countitem == $rows) { $countitem = 0; ?> </li> <?php } $countitem++; } wp_reset_query(); ?> </ul> </div> </div> <?php } ?> <div class="clear"></div> <?php }
<?php echo pmc_translation('translation_by', 'By: '); ?> <?php echo get_the_author_link(); ?> - <a href="<?php echo get_permalink(get_the_id()); ?> #commentform"><?php comments_number(); ?> </a> </div> </div> <div class="blogContent"> <div class="blogcontent"><?php echo shortcontent('[', ']', '', $post->post_content, 300); ?> ...</div> <a class="blogmore" href="<?php the_permalink(); ?> "><?php echo pmc_translation('translation_morelinkblog', 'Read more about this...'); ?> </a> </div> </div> </div>
function pmc_portfolio($portSize, $item, $post = 'port', $number = 0, $cat = '') { wp_enqueue_script('pmc_isotope'); global $pmc_data; $categport = ''; $paged = get_query_var('paged') ? get_query_var('paged') : 1; if ($number != 0) { $showposts = $number; } if ($item == 3) { $titleChar = 999; } else { if ($item == 2) { $titleChar = 25; } else { $titleChar = 28; } } if ($post == 'post') { $postT = 'post'; $postC = 'category'; $categport = ""; } else { $postT = $pmc_data['port_slug']; $postC = 'portfoliocategory'; } if ($cat != '') { $args = array('tax_query' => array(array('taxonomy' => $postC, 'field' => 'id', 'terms' => $cat)), 'showposts' => $showposts, 'post_type' => $postT, 'paged' => $paged); } else { $args = array('showposts' => $showposts, 'post_type' => $postT, 'paged' => $paged); } query_posts($args); $currentindex = $linkPost = ''; $counter = 0; $portfolio = ''; $count = 0; while (have_posts()) { the_post(); if ($post == 'post') { $postmeta = get_post_custom(get_the_ID()); } $do_not_duplicate = get_the_ID(); $image = wp_get_attachment_image_src(get_post_thumbnail_id(), $portSize, false); $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full', false); $entrycategory = get_the_term_list(get_the_ID(), $postC, '', ',', ''); $catstring = $entrycategory; $catstring = strip_tags($catstring); $catidlist = explode(",", $catstring); $catlist = ''; for ($i = 0; $i < sizeof($catidlist); ++$i) { $catidlist[$i] .= $currentindex; $find = array("&", "/", " ", "amp;", "&"); $replace = array("", "", "", "", ""); $catlist .= str_replace($find, $replace, $catidlist[$i]) . ' '; } $counter++; $categoryIn = get_the_term_list(get_the_ID(), $postC, '', ', ', ''); $category = explode(',', $categoryIn); if (has_post_format('link', get_the_ID()) and $post == 'post') { if (isset($postmeta["link_post_url"][0])) { $linkPost = $postmeta["link_post_url"][0]; } } else { if (function_exists('icl_object_id')) { $linkPost = get_permalink(icl_object_id(get_the_ID(), $pmc_data['port_slug'], true, true)); } else { $linkPost = get_permalink(); } } if ($item != 2) { $portfolio .= '<div class="item' . $item . ' ' . $catlist . '" data-category="' . $catlist . '">'; if ($item != 3) { $portfolio .= ' <div class="recentimage"> <a class="overdefultlink" href="' . $linkPost . '"> <div class="overdefult"> <div class="portIcon"></div> </div> </a> <div class="image"> <div class="loading"></div> <img src="' . $image[0] . '"> </div> </div>'; } if ($item == 3) { $portfolio .= ' <a href = "' . $full_image[0] . '" title="' . esc_attr(get_the_title(get_the_id())) . '" rel="lightbox" > <div class="recentimage"> <div class="overdefult"> <div class="portIcon"></div> </div> <div class="image"> <div class="loading"></div> <img src="' . $image[0] . '" alt="' . get_the_title() . '"> </div> </div> </a>'; } if ($item != 3) { $title = substr(the_title('', '', FALSE), 0, 17); if (strlen(the_title('', '', FALSE)) > 17) { $title = substr(the_title('', '', FALSE), 0, 17) . '...'; } $portfolio .= '<div class="recentdescription"> <h3><a class="overdefultlink" href="' . $linkPost . '">' . $title . '</a></h3> <div class="portCategory">' . $category[0] . '</div> </div>'; } if ($item == 3) { $title = substr(the_title('', '', FALSE), 0, 99); if (strlen(the_title('', '', FALSE)) > 99) { $title = substr(the_title('', '', FALSE), 0, 99) . '...'; } $portfolio .= '<div class="shortDescription"> <div class="descriptionHomePortText"> <h3><a href="' . $linkPost . '">' . $title . '</a></h3> </div> <div class="description">' . shortcontent("[", "]", "", get_the_content(), 90) . '...' . pmc_closeTagsReturn(shortcontent("[", "]", "", get_the_content(), 90)) . '</div> <div class="recentdescription-text"><a href="' . get_permalink(get_the_id()) . '">' . pmc_translation('translation_morelinkblog', 'Read more about this...') . '</a></div> </div>'; } $portfolio .= '</div>'; } else { $category = get_the_term_list(get_the_ID(), $postC, '', '', ''); $categoryHover = get_the_term_list(get_the_ID(), $postC, '', ', ', ''); if ($count != 2) { $portfolio .= '<div class="one_half item2 ' . $catlist . '" data-category="' . $catlist . '" >'; } else { $portfolio .= '<div class="one_half last item2 ' . $catlist . '" data-category="' . $catlist . '" >'; $count = 0; } $portfolio .= ' <div class="recentimage"> <a class="overdefultlink" href="' . $linkPost . '"> <div class="overdefult"> <div class="portDate"><i class="icon-calendar"></i>' . get_the_date() . '</div> <div class="portIcon"></div> <div class="portCategory">' . $categoryHover . '</div> </div> </a> <div class="image"> <div class="loading"></div> <img src="' . $full_image[0] . '"> </div> </div> <div class="recentdescription"> <h3><a class="overdefultlink" href="' . $linkPost . '">' . substr(the_title('', '', FALSE), 0, 99999) . '</a></h3> <h3 class="category">' . $category . '</h3> <div class="description">' . shortcontent("[", "]", "", get_the_content(), 125) . '...' . pmc_closeTagsReturn(shortcontent("[", "]", "", get_the_content(), 125)) . '</div> </div> </div>'; $count++; } } echo $portfolio; }