function homepage_slider() { query_posts(array('posts_per_page' => -1, 'post__in' => get_option('sticky_posts'), 'meta_key' => '_thumbnail_id')); ?> <?php if (have_posts()) { ?> <style> .bx-slider{display:none;} </style> <ul class="bx-slider"> <?php while (have_posts()) { the_post(); echo '<li><a href="' . get_permalink() . '">'; echo '<span class="bx-caption">'; the_title('<h1>', '</h1>'); if (has_excerpt()) { echo '<p>'; the_excerpt(); echo '</p>'; } echo '</span>'; the_post_thumbnail('full', 'title="' . get_the_title() . '"'); echo '</a></li>'; } ?> </ul> <?php } wp_reset_query(); }
function manage_portfolio_columns($column) { global $post; if ($post->post_type == "portfolio") { switch ($column) { case "description": the_excerpt(); break; case "portfolio_categories": $terms = get_the_terms($post->ID, 'portfolio_category'); if (!empty($terms)) { foreach ($terms as $t) { $output[] = "<a href='edit.php?post_type=portfolio&portfolio_tag={$t->slug}'> " . esc_html(sanitize_term_field('name', $t->name, $t->term_id, 'portfolio_tag', 'display')) . "</a>"; } $output = implode(', ', $output); } else { $t = get_taxonomy('portfolio_category'); $output = "No {$t->label}"; } echo $output; break; case 'thumbnail': echo the_post_thumbnail('thumbnail'); break; } } }
/** * Display the post content with a link to the single post * @since 1.0.0 */ function storefront_post_content() { ?> <?php if (is_search()) { ?> <div class="entry-summary"> <h2><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h2> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php } else { ?> <div class="entry-content" itemprop="articleBody"> <?php if (has_post_thumbnail()) { the_post_thumbnail('full', array('itemprop' => 'image')); } the_content(sprintf(__('Continue reading %s', 'storefront'), '<span class="screen-reader-text">' . get_the_title() . '</span>')); wp_link_pages(array('before' => '<div class="page-links">' . __('Pages:', 'storefront'), 'after' => '</div>')); ?> </div><!-- .entry-content --> <?php } }
function widget($args, $instance) { global $post, $wp_query; Protect(); extract($args, EXTR_SKIP); $post_query = 'showposts=1&cat=' . $instance['thecat']; $posts =& query_posts($post_query); if (have_posts()) { while (have_posts()) { the_post(); echo $before_widget; $title = empty($instance['title']) ? 'Latest Excerpt' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <ul> <li><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></li> <li><?php the_excerpt(); ?> </li> </ul> <?php echo $after_widget; } } UnProtect(); }
function thinkup_input_blogtext() { global $more; global $post; global $thinkup_blog_postswitch; // Output post thumbnail / featured media if (is_search()) { the_excerpt(); } else { if (!is_search()) { if ($thinkup_blog_postswitch == 'option1' or empty($thinkup_blog_postswitch)) { the_excerpt(); } else { if ($thinkup_blog_postswitch == 'option2') { // Allow user to user <!--more--> HTML tag $more = 0; // Remove all HMTL from the_content - Only allow specified tags ob_start(); the_content(''); $old_content = ob_get_clean(); $new_content = strip_tags($old_content, '<p><a><b><br/><br /><input><form><textarea><li><ol><ul><table><h1><h2><h3><h4><h5><h6>'); echo $new_content; } } } } }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); global $wp_query; $get_quotes = new WP_Query("post_type=quotes&post_status=publish&posts_per_page=1&orderby=rand"); ?> <li class="featured-quote"> <?php while ($get_quotes->have_posts()) { $get_quotes->the_post(); global $post; $link = get_post_meta($post->ID, "info_box_link", true); ?> <blockquote> <?php the_excerpt(); ?> </blockquote> <cite>~ <a href="<?php echo $link; ?> "><?php the_title(); ?> </a></cite> <?php } ?> </li> <?php }
/** * POST CONTENT - query posts * * output post content for Query Posts widget, based on predefined arguments * @since 7.0 */ function bizz_post_content_query($args = '', $post_count = false) { global $wp_query, $post, $opt; bizz_hook_before_post($post_count); #hook echo "<" . apply_filters('bizz_html5_section', "div") . " class=\"format_text\">\n"; $selflink = isset($args['thumb_selflink']) && $args['thumb_selflink'] == true ? true : false; $cropp = isset($args['thumb_cropp']) && $args['thumb_cropp'] != '' ? $args['thumb_cropp'] : 'c'; if (isset($opt['bizzthemes_thumb_show']['value']) && $args['thumb_display']) { bizz_image('width=' . $args['thumb_width'] . '&height=' . $args['thumb_height'] . '&class=thumbnail ' . $args['thumb_align'] . '&cropp=' . $cropp . '&selflink=' . $selflink . '&filter=' . $args['thumb_filter'] . '&sharpen=' . $args['thumb_sharpen'] . ''); } if ($args['remove_posts'] == '0') { if ($args['full_posts'] == '0' && (is_archive() || $wp_query->is_posts_page || is_search() || is_home())) { the_excerpt(); if ($args['read_more']) { echo apply_filters('bizz_read_more', '<span class="read-more"><a href="' . get_permalink() . '" class="url fn" rel="nofollow">' . $args['read_more_text'] . '</a></span>'); } } else { the_content($args['read_more_text']); } wp_link_pages(array('before' => '<div class="page-link">', 'after' => '</div>')); } echo '<div class="fix"><!----></div>'; echo "</" . apply_filters('bizz_html5_section', "div") . ">\n"; bizz_hook_after_post($post_count); #hook }
/** * Customize the columns in the table of all post types * * @since 1.0.0 */ public function custom_columns($column) { global $post; switch ($column) { case "image": if (has_post_thumbnail()) { echo get_the_post_thumbnail(null, 'thumb-testimonial'); } break; case 'story': the_excerpt(); break; case 'website': $label = yit_get_post_meta(get_the_ID(), '_site-label'); $siteurl = yit_get_post_meta(get_the_ID(), '_site-url'); if ($siteurl != '') { if ($label != '') { echo '<a href="' . esc_url($siteurl) . '">' . $label . '</a>'; } else { echo '<a href="' . esc_url($siteurl) . '">' . $siteurl . '</a>'; } } break; } }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); $post_type = $instance['post_type']; $link_text = $instance['link_text']; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } query_posts(array('post_type' => $post_type, 'showposts' => 1)); if (have_posts()) { while (have_posts()) { the_post(); $content = substr(get_the_content(), 0, 100); the_title('<h4>', '</h4>'); the_excerpt(); ?> <a href="<?php the_permalink(); ?> " class="btn_Select" title="<?php the_title_attribute(); ?> "><span><?php echo $link_text; ?> </span><strong>></strong></a><?php } } else { _e('Sorry, no posts matched your criteria.'); } wp_reset_query(); echo $after_widget; }
function post_excerpts_here() { //posts with date, author, time, content excerpts, and title.. if (have_posts()) { while (have_posts()) { echo '<div class="excerpt-div">'; the_post(); echo '<h2 class="post-title"><a href="'; the_permalink(); echo '" title="'; the_title(); echo '">'; the_title(); echo '</a></h2>'; echo '<h4 class="post-info">'; echo 'Created on '; the_date(); echo ' at '; the_time(); echo ' by '; the_author_meta(first_name); echo '.</h4>'; echo '<p class="post-excerpt">'; the_excerpt(); echo '</p>'; echo '</div>'; } // end while } // end if }
function my_facebook_tags() { if (is_single()) { ?> <meta property="og:title" content="<?php the_title(); ?> " /> <meta property="og:site_name" content="<?php bloginfo('name'); ?> " /> <meta property="og:url" content="<?php the_permalink(); ?> " /> <meta property="og:description" content="<?php the_excerpt(); ?> " /> <meta property="og:type" content="article" /> <?php if (has_post_thumbnail()) { $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); ?> <meta property="og:image" content="<?php echo $image[0]; ?> " /> <?php } } }
function organizedthemes_manage_testimony_columns($column, $post_id) { global $post; switch ($column) { /* If displaying the 'job title' column. */ case 'testimony_title': /* Get the post meta. */ $job_title = get_post_meta($post_id, 'title', true); /* If no duration is found, output a default message. */ if (empty($job_title)) { echo __('', 'organizedthemes'); } else { printf(__('%s'), $job_title); } break; /* If displaying the 'testimony-group' column. */ /* If displaying the 'testimony-group' column. */ case "testimony_content": //Adds the excerpt to the bio column the_excerpt(); break; /* Just break out of the switch statement for everything else. */ /* Just break out of the switch statement for everything else. */ default: break; } }
function load_posts() { // variaveis da query $numPosts = isset($_GET['numPosts']) ? $_GET['numPosts'] : 0; $page = isset($_GET['page']) ? $_GET['page'] : 0; // modificados do loop query_posts(array('post_por_page' => $numPosts, 'paged' => $page, 'post_status' => 'publish', 'post_type' => 'post')); // loop if (have_posts()) { while (have_posts()) { the_post(); ?> <article class="artigos"> <h1><?php the_title(); ?> </h1> <?php the_excerpt(); ?> </article> <?php } } // limpa da memória a query wp_reset_query(); // finaliza o script wp_die(); }
/** * kool_preview_boxes shows the next set of posts. It shows as many boxes as * you show posts on your blog page. This works best when there is an even * number of posts displayed (2,4,6,8,10) but it can work with an odd number * if alignment is set or if the width of boxes is set to 100% which would allow * for a column effct. * * To use kool_preview simply add the function call in your theme's index after * the content is displayed. I could technically go before as well. */ function kool_preview_boxes() { global $post; if (is_paged()) { $target_page = get_query_var('paged') + 1; } else { $target_page = 2; } $args = array('paged' => $target_page, 'orderby' => 'post_date', 'post_type' => 'post', 'post_status' => 'publish'); $k_posts = new WP_Query($args); if ($k_posts and $k_posts->have_posts()) { while ($k_posts->have_posts()) { $k_posts->the_post(); $thumb_query = array('numberposts' => 1, 'post_type' => 'attachment', 'post_parent' => $post->ID); echo '<div class="preview_box" >'; $attachment = get_posts($thumb_query); foreach ($attachment as $attach) { if ($attach) { $img = wp_get_attachment_image_src($attach->ID, $size = 'thumbnail', $icon = true); echo "<img class='preview_thumb' src='{$img['0']}' >"; } } echo '<a rel="bookmark" href='; the_permalink(); echo '>'; echo the_title() . '</a><br>'; the_excerpt(); echo "</div>"; } } }
function categori_news(){ query_posts('cat=9&showposts=10&posts_per_page=3'); while (have_posts()) : the_post(); /*Dima insert*/the_excerpt(); ?> <div class="content-box"> <div class="bgr01"><div class="bgr02"><div class="bgr03"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; "> <div class="title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="date_all"> <?php the_time('l, j ?F, Y') ?> </div> <div class="post"> Написал <?php the_author_link() ?> <?php the_time('g:i A') ?> </div> </div> <div class="content_box"> <?php the_content('Читать всё'); ?> </div> <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div> <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div> <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div> </div> </div></div></div> </div> <?php endwhile;}
/** ** Front-end display of widget. ** ** @see WP_Widget::widget() ** ** @param array $args Widget arguments. ** @param array $instance Saved values from database. **/ function widget($args, $instance) { extract($args); $thisTitle = $instance['title']; $thisNumber = $instance['num']; $thisCategory = $instance['cat']; $category_link = get_category_link($thisCategory); $titleBarSpan = '<span class="block section-title-bar">' . $thisTitle . '</span>'; $titleBarLink = '<a href="' . esc_url($category_link) . '">' . $titleBarSpan . '</a>'; $argsQueryPosts = array('cat' => $thisCategory, 'showposts' => $thisNumber); $thisQuery = new WP_Query($argsQueryPosts); echo "\n"; echo ' <div class="container newlife-widget newlife-snippet-posts">' . "\n"; if ($thisCategory != 0) { echo ' ' . $titleBarLink . "\n"; } else { echo ' ' . $titleBarSpan . "\n"; } echo ' <div class="snippet-posts">' . "\n"; while ($thisQuery->have_posts()) { $thisQuery->the_post(); ob_start(); ?> <div class="post"> <div class="post-title"> <h2><a href="<?php echo get_permalink(); ?> " rel="bookmark"><?php echo the_title(); ?> </a></h2> </div> <div class="post-entry"> <?php the_excerpt(); echo "\n"; ?> </div> <div class="post-meta"> <?php newlife_post_data(); echo "\n"; ?> </div> <div class="clear"></div> </div> <?php echo ob_get_clean(); } echo ' <div class="navigation-posts">' . "\n"; echo ' </div>' . "\n"; echo ' <div class="clear"></div>' . "\n"; echo ' </div>' . "\n"; echo " </div>\n"; wp_reset_postdata(); }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $post_type = $instance['post_type']; $num_items = $instance['num_items']; query_posts(array('post_type' => $post_type, 'showposts' => $num_items)); if (have_posts()) { ?> <div id="myCarousel" class="carousel slide"> <div class="carousel-inner"> <?php global $post; $count = 0; while (have_posts()) { the_post(); //var_dump($post); ?> <div class="item <?php echo $count == 0 ? 'active' : ''; ?> "> <?php if (has_post_thumbnail()) { the_post_thumbnail('portfolio-slider-image'); } ?> <div class="container"> <div class="carousel-caption"> <?php the_title('<h1>', '</h1>'); ?> <p class="lead"><?php the_excerpt(); ?> </p> <a class="btn btn-large btn-primary" href="<?php the_permalink(); ?> ">View project</a> </div> </div> </div> <?php $count++; } ?> </div> <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a> <a class="right carousel-control" href="#myCarousel" data-slide="next">›</a> </div><!-- /.carousel --> <?php } else { _e('Sorry, no posts matched your criteria.'); } wp_reset_query(); }
function tree_species_post_excerpt() { if (get_post_type() == 'post') { the_excerpt(); } else { the_tree_species_exceprt(); } }
function the_pickup_excerpt() { add_filter('get_the_excerpt', 'get_pickup_excerpt', 0); add_filter('excerpt_mblength', 'pickup_excerpt_length', 11); the_excerpt(); remove_filter('get_the_excerpt', 'get_pickup_excerpt', 0); remove_filter('excerpt_mblength', 'pickup_excerpt_length', 11); }
function powen_content() { if (powen_mod('content_length') == 'full') { the_content(); } else { the_excerpt(); } }
function widget($args, $instance) { extract($args); global $post; $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $category = isset($instance['category']) ? $instance['category'] : ''; $offset = empty($instance['offset']) ? '' : $instance['offset']; if ($category) { $cat_url = get_category_link($category); $before_title = '<a href="' . esc_url($cat_url) . '" class="widget-title-link">'; $after_title = '</a>'; } else { $before_title = ''; $after_title = ''; } echo $before_widget; if (!empty($title)) { echo '<div class="separator"><h4 class="widget-title section-title">' . $before_title . esc_attr($title) . $after_title . '</h4></div>'; } ?> <ul class="latest-news-widget row clearfix"><?php $args = array('posts_per_page' => '3', 'offset' => $offset, 'cat' => $category, 'ignore_sticky_posts' => 1); $widget_loop = new WP_Query($args); while ($widget_loop->have_posts()) { $widget_loop->the_post(); ?> <li class="news-item mh-col-1-3"> <h3 class="news-item-title"><a href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a></h3> <div class="news-item-excerpt"><?php the_excerpt(); ?> </div> <a class="news-item-more button" href="<?php the_permalink(); ?> " title="<?php the_title_attribute(); ?> "><?php _e('Read more', 'mh-elegance-lite'); ?> </a> </li><?php } wp_reset_postdata(); ?> </ul><?php echo $after_widget; }
/** * Customizing the list view columns * * This functions is attached to the 'manage_posts_custom_column' action hook. */ function faqs_columns($column, $post_id) { $faq_data = get_post_meta($post_id, '_faq', true); switch ($column) { case 'Answer': the_excerpt(); break; } }
function ab_arq_project_custom_columns($column) { global $post; switch ($column) { case "description": the_excerpt(); break; } }
/** * Customize the columns in the table of all post types * * @since 1.0.0 */ public function custom_columns($column) { global $post; switch ($column) { case 'desc': the_excerpt(); break; } }
function my_add_short_description() { ?> <div class="short-description"><?php the_excerpt(); ?> </div> <?php }
function hopscotch_modify_the_content() { // if ( ( is_home() || is_archive() ) && 'image' == get_post_format() ) { if (is_home() || is_archive() || is_search()) { the_excerpt(); } else { the_content(); } }
function excerpt() { global $post; add_filter('excerpt_more', '_excerpt_more'); add_filter('excerpt_length', '_excerpt_length'); the_excerpt(); remove_filter('excerpt_more', '_excerpt_more'); remove_filter('excerpt_length', '_excerpt_length'); }
/** * @desc Output of the Excerpt * @author Georg Leciejewski */ function c_widget_excerpt($args, $number = 1) { $options = get_option('c_widget_excerpt'); $before_widget = stripslashes($options[$number]['before_widget']); $after_widget = stripslashes($options[$number]['after_widget']); echo $before_widget . "\n"; the_excerpt(); echo $after_widget . "\n"; }
function widget($args, $instance) { extract($args); /* User-selected settings. */ if (!isset($instance['title'])) { $instance['title'] = ''; } $title = apply_filters('widget_title', $instance['title']); $img_url = ''; if (!empty($instance['icon_img'])) { $img_url = get_template_directory_uri() . '/images/icons/widget/' . $instance['icon_img'] . '.png'; } else { if (!empty($instance['img_url'])) { $img_url = $instance['img_url']; } } $test_fx = isset($instance['test_fx']) ? $instance['test_fx'] : 'fade'; $test_timeout_fx = isset($instance['test_timeout_fx']) ? $instance['test_timeout_fx'] : 5000; $test_speed_fx = isset($instance['test_speed_fx']) ? $instance['test_speed_fx'] : 500; $test_n_items = isset($instance['test_n_items']) ? $instance['test_n_items'] : 5; $size = 32; global $more, $post; $more = 0; wp_reset_query(); $test_posts = new WP_Query("post_type=bl_testimonials&posts_per_page={$test_n_items}"); if ($test_posts->have_posts()) { echo $before_widget; if ($title) { echo $before_title . '<img src="' . $img_url . '" title="" alt="" />' . $title . $after_title; } echo '<div class="testimonial-text">'; echo '<ul>'; while ($test_posts->have_posts()) { $test_posts->the_post(); echo '<li>'; echo '<blockquote>'; the_excerpt(); the_title('<div class="name-testimonial"><a class="name-testimonial" href="' . get_permalink(get_the_ID()) . '">', ' </a></div>'); $label = get_post_meta(get_the_ID(), '_testimonial_label', true); $website = get_post_meta(get_the_ID(), '_testimonial_website', true); $website = "<a class='url-testimonial' href=\"" . esc_url($website) . "\">" . $label . "</a>"; if ($label) { echo $website; } echo '</blockquote>'; echo '</li>'; } echo '</ul>'; //echo '<div class="p-testimonial"></div>'; echo '</div>'; $script = "<script type=\"text/javascript\">\r\r\n jQuery(document).ready(function(\$){\r\r\n \$('.testimonial-widget ul').cycle({\r\r\n fx:'{$test_fx}',\r\r\n timeout:{$test_timeout_fx},\r\r\n speed:{$test_speed_fx}, \r\r\n pager:'.p-testimonial'\r\r\n });\r\r\n });\r\r\n </script>"; echo $script; echo $after_widget; } wp_reset_query(); }
function playne_readmore() { global $post; $ismore = @strpos($post->post_content, '<!--more-->'); if ($ismore) { the_content(__('<div class="centered"><a class="more-linkd" href="' . get_permalink() . '">Read More</a></div>', 'playne')); } else { the_excerpt(__('<div class="centered"><a class="more-linkd" href="' . get_permalink() . '">Read More</a></div>', 'playne')); } }