<div class="portfolio-detail"> <h4> <a href="<?php the_permalink(); ?> " data-ajax-id="<?php echo $the_id; ?> "> <?php the_title(); ?> </a> </h4> <p> <?php echo dtthemes_mytheme_excerpt(18); ?> </p> </div> </div><!--. portfolio--> </div> <?php $count++; } } ?> <?php } ?>
function widget($args, $instance) { extract($args); global $post; $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $_post_count = (int) $instance['_post_count']; $_post_categories = ""; if (!empty($instance['_post_categories']) && is_array($instance['_post_categories'])) { $_post_categories = array_filter($instance['_post_categories']); } elseif (!empty($instance['_post_categories'])) { $_post_categories = explode(",", $instance['_post_categories']); } $_enabled_image = isset($instance['_enabled_image']) ? $instance['_enabled_image'] : 0; $show_title = $instance['_excerpt'] == 'show title only' ? (bool) true : (bool) false; $arg = array('posts_per_page' => $_post_count, 'post_type' => 'portfolio'); $arg = empty($_post_categories) ? $arg : array('posts_per_page' => $_post_count, 'tax_query' => array(array('taxonomy' => 'portfolio_entries', 'field' => 'id', 'operator' => 'IN', 'terms' => $_post_categories))); echo $before_widget; echo $before_title . $title . $after_title; echo "<ul>"; query_posts($arg); if (have_posts()) { while (have_posts()) { the_post(); $title = strlen(get_the_title()) > 20 ? substr(get_the_title(), 0, 15) . "..." : get_the_title(); echo "<li>"; if (1 == $_enabled_image) { $portfolio_settings = get_post_meta($post->ID, '_portfolio_settings', TRUE); $portfolio_settings = is_array($portfolio_settings) ? $portfolio_settings : array(); if (array_key_exists("items_name", $portfolio_settings)) { $item = $portfolio_settings['items_name'][0]; $image; if ("video" === $item) { $image = "http://placehold.it/90&text=Video%20Portfolio"; } else { $image = $portfolio_settings['items'][0]; } } else { $image = "http://placehold.it/90&text=Add%20Image%20/%20Video%20%20to%20Portfolio"; } echo "<a href='" . get_permalink() . "' class='thumb'>"; echo "<img src='{$image}' alt='{$title}'/>"; echo "</a>"; } if ($show_title) { echo "<h4><a href='" . get_permalink() . "'>{$title}</a></h4>"; } else { echo "<h4><a href='" . get_permalink() . "'>{$title}</a></h4>"; echo dtthemes_mytheme_excerpt(); } echo "</li>"; } } else { echo "<li>" . __('No Portfolio Entries found', 'dt_rise') . "</li>"; } wp_reset_query(); echo "</ul>"; echo $after_widget; }
?> <?php } ?> <?php if (!isset($tpl_default_settings['disable-tag-info'])) { ?> <?php the_tags(); ?> <?php } ?> </div><?php echo dtthemes_mytheme_excerpt($excerpt_length); ?> <footer> <a href="<?php the_permalink(); ?> "><?php _e("read more", "dt_rise"); ?> <i class="icon-circle-arrow-right"></i></a> </footer> </div> </div> </div> </li> <?php
function widget($args, $instance) { extract($args); global $post; $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); $_pages = ""; if (!empty($instance['_pages']) && is_array($instance['_pages'])) { $_pages = array_filter($instance['_pages']); } elseif (!empty($instance['_pages'])) { $_pages = explode(",", $instance['_pages']); } $_enabled_image = isset($instance['_enabled_image']) ? $instance['_enabled_image'] : 0; $show_title = $instance['_excerpt'] == 'show title only' ? (bool) true : (bool) false; $arg = empty($_pages) ? array('post_type' => 'page') : array('post_type' => 'page', 'post__in' => $_pages); echo $before_widget; echo $before_title . $title . $after_title; echo "<ul>"; query_posts($arg); if (have_posts()) { while (have_posts()) { the_post(); $title = strlen(get_the_title()) > 20 ? substr(get_the_title(), 0, 19) . "..." : get_the_title(); echo "<li>"; if (1 == $_enabled_image) { $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'my-post-thumb', false); $image = $image != false ? $image[0] : IAMD_BASE_URL . "/images/dummy-images/poster-my-post-thumb.jpg"; echo "<a href='" . get_permalink() . "' class='thumb'>"; echo "<img src='{$image}' width='71' height='63' alt='{$title}'/>"; echo "</a>"; } if ($show_title) { echo "<h6>{$title}</h6>"; } else { echo "<h6>{$title}</h6>"; #echo dtthemes_mytheme_excerpt('mytheme_excerptlength_teaser1', 'mytheme_excerptmore'); echo dtthemes_mytheme_excerpt(); } echo "</li>"; } } else { echo "<li><h6>" . __('No Pages found', 'dt_rise') . "</h6></li>"; } wp_reset_query(); echo "</ul>"; echo $after_widget; }