function my_posts($attrs, $content = null, $shortcodename = "") { global $post; $tpl_default_settings = get_post_meta($post->ID, '_tpl_default_settings', TRUE); $tpl_default_settings = is_array($tpl_default_settings) ? $tpl_default_settings : array(); $page_layout = isset($tpl_default_settings['layout']) ? $tpl_default_settings['layout'] : "content-full-width"; $post_class = " column one-half "; $last = NULL; $out = NULL; extract(shortcode_atts(array('categories' => '', 'count' => "-1", 'column' => 2, 'read_more_text' => __('Read More', 'dt_delicate'), 'excerpt_length' => 12), $attrs)); switch ($column) { default: case '2': default: $post_class = $page_layout == "content-full-width" ? $post_class : $post_class . " with-sidebar"; $last = 2; break; case '3': $post_class = $page_layout == "content-full-width" ? " column one-third " : " column one-third with-sidebar "; $last = 3; break; } #$categories = explode(",",$categories); #$categories = array_filter(array_unique($categories)); if (empty($categories)) { $args = array('paged' => get_query_var('paged'), 'posts_per_page' => $count, 'post_type' => 'post'); } else { $args = array('paged' => get_query_var('paged'), 'posts_per_page' => $count, 'cat' => $categories, 'post_type' => 'post'); } query_posts($args); if (have_posts()) { $count = 1; while (have_posts()) { the_post(); $id = get_the_ID(); $title = get_the_title(); $permalink = get_permalink($id); $categories = get_the_category(); $cats = ""; if ($categories) { foreach ($categories as $category) { $cats .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'dt_delicate'), $category->name)) . '">' . $category->cat_name . '</a>,'; } $cats = substr($cats, 0, strlen($cats) - 1); } $class = $last > 1 && $count % $last == 0 ? $post_class . ' last' : $post_class; $out .= "<div class='{$class}'>"; $out .= ' <article class="blog-entry">'; $out .= ' <div class="entry-thumb-meta">'; $out .= "\t\t<div class='entry-thumb'><a href='{$permalink}'>"; if (has_post_thumbnail($id)) { $out .= get_the_post_thumbnail($id, "blog-column"); } else { $image = IAMD_BASE_URL . "images/dummy-images//blog-column.jpg"; $out .= "<img src='{$image}' />"; } $out .= ' </a></div>'; $out .= ' <div class="entry-meta">'; $out .= ' <div class="date">'; $out .= "\t\t\t\t<span class='icon-calendar'></span><p>" . get_the_date('F') . ' ' . get_the_date('d') . ' ' . get_the_date('Y') . "</p>"; $out .= ' </div>'; $commtext = ""; if (wp_count_comments($id)->approved == 0) { $commtext = '0'; } else { $commtext = wp_count_comments($id)->approved; } $out .= "\t\t\t<a href='{$permalink}/#respond' class='comments' title='{$title}'><span class='icon-comments'> </span>" . $commtext . "</a>"; $out .= ' <span class="rounded-bend"> </span>'; $out .= ' </div>'; $out .= ' </div>'; $out .= ' <div class="entry-details">'; $out .= "\t\t\t<div class='entry-title'><h4><a href='{$permalink}'>{$title}</a></h4></div>"; $out .= ' <div class="entry-metadata">'; #$out .= get_the_tag_list('<div class="tags"><span class="icon-tags"> </span>'.'',', ','</div>'); $out .= "\t\t\t\t<div class='categories'><span class='icon-pushpin'> </span>{$cats}</div>"; $out .= ' </div>'; $out .= ' <div class="entry-body">'; $out .= mytheme_excerpt($excerpt_length); $out .= "\t \t\t<a href='{$permalink}' class='read-more'>{$read_more_text} <span class='icon-double-angle-right'> </span></a>"; $out .= ' </div>'; $out .= ' </div>'; $out .= ' </article>'; $out .= '<div class="hr-invisible-small"> </div>'; $out .= "</div>"; $count++; } } wp_reset_query(); return $out; }
"><?php the_title(); ?> </a></h5> <?php if (array_key_exists("sub-title", $portfolio_item_meta)) { echo "<p>{$portfolio_item_meta['sub-title']}</p>"; } ?> <?php if ($show_content_in_one_column) { ?> <div class="portfolio-description"> <?php echo mytheme_excerpt(70); ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s'), the_title_attribute('echo=0')); ?> " class="button small"> <?php _e('View Details ', 'dt_delicate'); ?> </a> </div> <?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 "<div class='recent-pages-widget'><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 mytheme_excerpt('mytheme_excerptlength_teaser1', 'mytheme_excerptmore'); echo mytheme_excerpt(); } echo "</li>"; } } else { echo "<li><h6>" . __('No Pages found', 'dt_delicate') . "</h6></li>"; } wp_reset_query(); echo "</ul></div>"; echo $after_widget; }
?> </a></h4></div><!-- .entry-title --> <div class="entry-metadata"> <?php the_tags('<div class="tags"><span class="icon-tags"> </span>' . '', ', ', '</div>'); ?> <div class="categories"><span class="icon-pushpin"> </span><?php the_category(', '); ?> </div> </div><!-- .entry-meta --> <div class="entry-body"> <?php echo mytheme_excerpt(20); ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s'), the_title_attribute('echo=0')); ?> " class="read-more"> <?php _e('Read More', 'dt_delicate'); ?> <span class="icon-double-angle-right"> </span></a> </div><!-- .entry-body --> </div><!-- .entry-details -->
?> </a></h4></div><!-- .entry-title --> <div class="entry-metadata"> <?php the_tags('<div class="tags"><span class="icon-tags"> </span>' . '', ', ', '</div>'); ?> <div class="categories"><span class="icon-pushpin"> </span><?php the_category(', '); ?> </div> </div><!-- .entry-meta --> <div class="entry-body"> <?php echo mytheme_excerpt(50); ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s'), the_title_attribute('echo=0')); ?> " class="read-more"> <?php _e('Read More', 'dt_delicate'); ?> <span class="icon-double-angle-right"> </span></a> </div><!-- .entry-body --> </div><!-- .entry-details -->
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 "<div class='recent-portfolio-widget'><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) { $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}' alt='{$title}'/>"; echo "</a>"; } if ($show_title) { echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>"; } else { echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>"; echo mytheme_excerpt(); } echo "</li>"; } } else { echo "<li>" . __('No Portfolio Entries found', 'dt_delicate') . "</li>"; } wp_reset_query(); echo "</ul></div>"; echo $after_widget; }
?> <?php if (!isset($tpl_default_settings['disable-category-info'])) { ?> <div class="categories"><span class="icon-pushpin"> </span><?php the_category(', '); ?> </div> <?php } ?> </div><!-- .entry-meta --> <div class="entry-body"> <?php echo mytheme_excerpt($tpl_default_settings['blog-post-excerpt-length']); ?> <a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('%s'), the_title_attribute('echo=0')); ?> " class="read-more"> <?php _e('Read More', 'dt_delicate'); ?> <span class="icon-double-angle-right"> </span></a> </div><!-- .entry-body --> </div><!-- .entry-details -->
function widget($args, $instance) { extract($args); global $post; $title = empty($instance['title']) ? '' : strip_tags($instance['title']); $_post_count = (int) $instance['_post_count']; $_post_categories = ""; if (!empty($instance['_post_categories'])) { $_post_categories = is_array($instance['_post_categories']) ? implode(",", $instance['_post_categories']) : $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 = empty($_post_categories) ? "posts_per_page={$_post_count}" : "cat={$_post_categories}&posts_per_page={$_post_count}"; echo $before_widget; echo $before_title . $title . $after_title; echo "<div class='recent-posts-widget'><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}' alt='{$title}'/>"; echo "</a>"; } if ($show_title) { echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>"; } else { echo "<h6><a href='" . get_permalink() . "'>{$title}</a></h6>"; echo mytheme_excerpt(); } echo "</li>"; } } else { echo "<li><h6>" . __('No Posts found', 'dt_delicate') . "</h6></li>"; } wp_reset_query(); echo "</ul></div>"; echo $after_widget; }