function search_posts($search) { global $wpdb, $WPInsights; $options = $WPInsights->get_options(); $limit = $options['post_results']; // create query $search = $wpdb->escape($search); $posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_type FROM {$wpdb->posts} WHERE post_status = 'publish' AND (post_title LIKE '%{$search}%' OR post_content LIKE '%{$search}%') ORDER BY post_title LIMIT 0," . $limit); // if ($posts) { foreach ($posts as $post) { // display every post link and excerpt $output .= ' <p> <a style="text-decoration:none;" href="' . get_permalink($post->ID) . '" target="_blank"> <strong>' . $post->post_title . '</strong> </a> <a href="' . $post->post_type . '.php?action=edit&post=' . $post->ID . '" ><img title="Edit ' . $post->post_type . '" src="' . $WPInsights->plugin_url . '/img/edit.png" /></a> <img title="Insert link to selection" style="cursor:pointer;" onclick="insert_link(\'' . get_permalink($post->ID) . '\');" src="' . $WPInsights->plugin_url . '/img/link.png" /> <p> ' . get_excerpt($post->post_content, 50) . '</p></p>'; } } else { $output .= 'Nothing found matching "' . stripslashes($search) . '"'; } return $output; }
function excerpt($custom_length = null, $echo = true) { $content = apply_filters('the_content', get_excerpt($custom_length)); if ($echo) { echo $content; } return $content; }
public function crest_get_page() { check_ajax_referer('cr_ajax_obj_wp_nonce'); $paged = $_POST['page']; // page number $curr_page = 0; $output = ''; if (filter_var(intval($paged), FILTER_VALIDATE_INT)) { $curr_page = $paged; $args = array('post_type' => 'event', 'paged' => $curr_page, 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_key' => 'date', 'posts_per_page' => 5); $loop = new WP_Query($args); if ($loop->have_posts()) { while ($loop->have_posts()) { $loop->the_post(); $articleID = get_the_ID(); $articleClass = post_class('cf'); $perma = get_permalink(); $title = get_the_title(); $excerpt = get_excerpt('<span class="read-more">' . __('Read more »', 'bonestheme') . '</span>'); $d = get_field('date'); $d2 = date('F d, Y', strtotime($d)); ?> <article id="post-<?php the_ID(); ?> " <?php post_class('cf'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting"> <header class="article-header"> <h3 class="search-title entry-title"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "><?php the_title(); ?> </a> </h3> <?php $d = get_field('date'); ?> <?php $d2 = date('F d, Y', strtotime($d)); ?> <div class="date"><?php echo $d2; ?> </div> </header> <section class="entry-content cf" itemprop="articleBody"> <?php the_excerpt('<span class="read-more">' . __('Read more »', 'bonestheme') . '</span>'); ?> </section> </article> <?php } wp_reset_query(); } } exit; }
</div> <div class="title"> <h3><a href="<?php the_permalink(); ?> " rel="bookmark"><?php the_title(); ?> </a></h3> </div> <div class="summary"> <?php echo catch_that_image(); echo get_excerpt(450); ?> </div> <div class="read-more"><a href="<?php the_permalink(); ?> ">Continue reading »</a></div> <div style="clear:both;"></div> <div class="posts-list"> <h4>Other recent posts</h4> <ul> <?php while (have_posts()) { the_post(); ?>
<img alt="Feature Image" width="80" class="feature_img_blog" src="<?php echo site_url('uploads') . "/blog/" . $blog[$i]['featured_image']; ?> " /> <?php $width = 'width:581px;'; } else { $width = 'width:600px;'; } ?> </div> <div class="blog_content_inner_right"> <div><?php echo get_excerpt($blog_description, 250, '...'); ?> </div> <div ><a style="padding-top:5px;" href="<?php echo site_url('blog/specific') . "/" . url_title($blog_title, 'dash', true) . "/" . $blog[$i]['blog_id']; ?> " class="more-link">more</a></div> </div> <!--</p>--> </div> </article> <hr class="sg_border"> <?php } ?> </div>
if ($key == 3) { break; } ?> <div class="recentPots"> <img alt="img" class="thumbRecentPost" src="<?php echo base_url() . '/uploads/' . $value['image']; ?> "> <div class="contentRecent"> <h5> <a href="#" class="titleRpost"><?php echo $value["title"]; ?> </a> </h5> <p class="contentRpots"><?php echo get_excerpt($value["description"], 100, '...'); ?> </p> <div class="clearfix"></div> </div> </div> <?php } ?> <!--.recentPots--> </div> </div> <!--.recentPots_cnt-->
<section id="content" role="main" class="fuller"> <div class="row"> <?php if (have_posts()) { while (have_posts()) { the_post(); echo '<div class="four columns covers fade-in-element">'; the_post_thumbnail('500,500', array('class' => 'u-full-width')); echo '<div class="post__excerpt">'; echo '<h2 class="releases"><a href="'; the_permalink(); echo '">'; the_title(); echo '</h2></a> '; echo '<p>'; echo get_excerpt(85); echo '</p></div>'; echo "</div>"; ?> <?php } } ?> </div> <div class="row"> <?php next_posts_link(); ?>
<a href="<?php the_permalink(); ?> " class="post short"> <header class="header"> <h3 class="title"><?php the_title(); ?> </h3> <span class="date"><?php the_time('d/m/Y'); ?> </span> </header> <p class="text"><?php echo get_excerpt($post->ID); ?> </p> <div class="link">Read More</div> </a> <?php } ?> </div> <!-- END content --> <?php if ($count > 4) { ?> <a role="button" class="load_more">Load more posts</a> <?php
?> " title="Read the full <?php the_title(); ?> post"><?php the_title(); ?> </a></h3> <h4 class="archive-location"><?php echo esc_html($category[0]->cat_name); ?> · <?php echo esc_html($location); ?> </h4> <p class="archive-excerpt"><?php echo get_excerpt(); ?> </p> </li> <?php } ?> </ul> </div> <?php get_footer();
* @hooked woocommerce_show_product_loop_sale_flash - 10 * @hooked woocommerce_template_loop_product_thumbnail - 10 */ do_action('woocommerce_before_shop_loop_item_title'); /** * woocommerce_shop_loop_item_title hook. * * @hooked woocommerce_template_loop_product_title - 10 */ do_action('woocommerce_shop_loop_item_title'); $artist = get_field('artist'); if ($artist) { setup_postdata($artist); $picture = get_the_post_thumbnail($artist, 'small-square'); $name = get_the_title($artist); $bio = get_excerpt($artist); $url = get_the_permalink($artist); ?> <h3 class="artist-name"><?php echo $name; ?> </h3> <?php wp_reset_postdata(); ?> <?php } /** * woocommerce_after_shop_loop_item_title hook. *
function category_two_posts_no_thumb_func($atts, $content) { //extract short code attr extract(shortcode_atts(array('title' => '', 'link' => '', 'category_name' => ''), $atts)); $custom_id = time() . rand(); $output_blog = ''; $output_blog .= "<div class='entry-title'><h3><span>{$title}</span></h3></div>"; global $wp_query; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('category_name=' . $category_name . '&showposts=2'); $current = -1; while ($wp_query->have_posts()) { $wp_query->the_post(); $current++; $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id, 'blog_post_image', true); $imgsource = $image_url[0]; global $post_id; $postID = get_post($post_id); global $post; $temp_link = get_permalink($post->ID); $temp_title = get_the_title($post->ID); $temp_date = get_the_time('M j, Y', $post->ID); $archive_year = get_the_time('Y'); $archive_month = get_the_time('m'); $temp_date_link = get_month_link($archive_year, $archive_month); $temp_author = get_the_author(); $temp_author_link = get_author_posts_url(get_the_author_meta('ID')); $temp_excerpt = get_excerpt(220, 'content'); $temp_excerpt_big = get_excerpt(320, 'content'); $categories = get_the_category(); $separator = ', '; $output = ''; if ($categories) { foreach ($categories as $category) { $output .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", "heman"), $category->name)) . '">' . $category->cat_name . '</a>' . $separator; } $categories_item = trim($output, $separator); } $output_blog .= "<div class='one_half "; if ($current % 2 == 0) { $output_blog .= "first "; } $output_blog .= "'>"; $output_blog .= "<div class='post-preview' style='margin-bottom: 0;'>"; $output_blog .= "<div class='full' style='margin-bottom: 0;'>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<h4><span style='font-weight: bold; margin-bottom: 10px; float: left; padding-bottom: 10px; border-bottom: dotted 1px #d7d7d7;'><a href='{$temp_link}'>{$temp_title}</a></span></h4>\r\n\t\t\t\t\t\t\t\t\t<div class='post-full'>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<p>By <a href='{$temp_author_link}'>{$temp_author}</a> on <a href='{$temp_date_link}'>{$temp_date}</a></p>\r\n\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t<p class='post-preview-excerpt'>{$temp_excerpt_big}</p>\r\n\t\t\t\t\t\t\t\t\t\t<span><a href='{$temp_link}'>Read More</a></span>\r\n\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t</div>\r\n\r\n\t\t\t\t\t\t\t\t</div>"; $output_blog .= "</div></div>"; } global $name; $category_id = get_cat_ID($name); $category_link = get_category_link($category_id); wp_reset_query(); if (!empty($link)) { $output_blog .= "<div class='full' style='text-align: center;'><a href='{$link}' class='button-ag large read-more' style='margin-right: 0; text-transform:uppercase;'><span class='button-inner'>More Items</span></a></div>"; } else { $output_blog .= ""; } return $output_blog; }
function artist_bio() { if (get_field('artist')) { $artist = get_field('artist'); if ($artist) { setup_postdata($artist); $picture = get_the_post_thumbnail($artist, 'small-square'); $name = get_the_title($artist); $bio = get_excerpt($artist); $url = get_the_permalink($artist); echo ' <div class="artist-widget"> <div class="profile-picture"><a href="' . $url . '">' . $picture . '</a></div> <h2>' . $name . '</h2> <p class="bio">' . $bio . '</p> <p><a href="' . $url . '">See More</a></p> </div> '; wp_reset_postdata(); } } }
</form> </div> <div class="clear"> </div> </div> </div> </div> <!----//End-find-place----> <!---start-services----> <div class="wrap"> <?php if (isset($page)) { echo get_page($page); } ?> <?php echo get_excerpt($articles, 400); ?> <div class="clear"></div> </div> </div> </div> <!---End-services----> <!---strat-date-piker----> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script>
if ($pagination) { ?> <section class="pagination"><?php echo $pagination; ?> </section> <?php } ?> <div class="row"> <?php if (count($articles)) { foreach ($articles as $article) { ?> <article class="span9"><?php echo get_excerpt($article); ?> <hr></article> <?php } } ?> </div> </div> <!-- Sidebar --> <div class="span3 sidebar"> <h2>Recent news</h2> <?php $this->load->view('sidebar'); ?>
<div class="media-obj__img-div"> <?php the_post_thumbnail('235x235'); ?> </div> <div class="media-obj__body"> <h3 class="u-margin-t-flush [ page-title ] media-obj-body__title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h3> <p> <?php echo get_excerpt(300); ?> </p> <a href="<?php the_permalink(); ?> " class="btn btn--topSection borderDouble button-dark">Read More</a> </div> </article> <?php } ?> <?php } else {
</tr> </thead> <tbody> <?php foreach ($remove_unsubscribe as $row) { if ($row['remove_unsubscribe'] == 'text') { $un = $row['unsubscribe_text']; } else { if ($row['remove_unsubscribe'] == 'url') { $un = $row['unsubscribe_url']; } } $status = $row['status'] == 'Active' ? 'Inactive' : 'Active'; echo '<tr>'; echo '<td>' . $row['remove_unsubscribe_id'] . '</td>'; echo '<td>' . get_excerpt($un, 100, '...') . '</td>'; echo '<td>' . $row['remove_unsubscribe'] . '</td>'; echo '<td>' . $row['status'] . '</td>'; echo '<td style="width:215px;" class="crud-actions"> <a href="' . site_url("kd2a2a0u1g4") . '/remove-unsubscribe/update/' . $row['remove_unsubscribe_id'] . '" class="btn btn-info">view & edit</a> <a href="' . site_url("kd2a2a0u1g4") . '/remove-unsubscribe/delete/' . $row['remove_unsubscribe_id'] . '" class="btn btn-danger complexConfirm">delete</a> </td>'; echo '</tr>'; } ?> </tbody> </table> <?php $this->session->set_userdata('redirect_url', current_url()); echo '<div class="pagination">' . $this->pagination->create_links() . '</div>';
<?php if (has_post_thumbnail()) { the_post_thumbnail('thumbnail'); } ?> <h4><?php the_title(); ?> </h4> <div class="postdate"><?php echo get_the_date(); ?> </div> <?php echo get_excerpt(20); //the_excerpt(); ?> <div class="q-readmore"><a href="<?php the_permalink(); ?> ">Read more</a></div> </div><!-- extra cat post --> <?php } ?> <?php } // end of latest post }
function prefix_load_posts() { $sanitizedRequest = sanitizeRequest($_POST); $args = array(); /* request key to wp_query key map */ $requestKeyToWpQueryKeyMap = array('onlyWithCategory' => 'cat', 'excludePosts' => 'post__not_in', 'limit' => 'posts_per_page', 'offset' => 'offset'); /* assign wp_query values */ foreach ($sanitizedRequest as $key => $value) { if (!isset($requestKeyToWpQueryKeyMap[$key])) { continue; } $args[$requestKeyToWpQueryKeyMap[$key]] = $value; } /* wp_query default values */ $args['post_status'] = array('publish'); $args['limit'] = isset($args['limit']) ? $args['limit'] : 6; $args['offset'] = isset($args['offset']) ? $args['offset'] : 0; $args['orderby'] = isset($args['orderby']) ? $args['orderby'] : 'modified'; $args['order'] = isset($args['order']) ? $args['order'] : 'DESC'; $excerptLength = isset($requestKeyToWpQueryKeyMap['excerptLength']) ? $requestKeyToWpQueryKeyMap['excerptLength'] : 110; $excerptStyleOption = isset($requestKeyToWpQueryKeyMap['excerptStyleOption']) ? $requestKeyToWpQueryKeyMap['excerptStyleOption'] : 1; $titleLength = isset($requestKeyToWpQueryKeyMap['titleLength']) ? $requestKeyToWpQueryKeyMap['titleLength'] : 27; $query = new WP_Query($args); $posts = $query->get_posts(); $results = array(); foreach ($posts as $post) { setup_postdata($post); $post_array = (array) $post; $post_array['permalink'] = get_permalink($post->ID); $post_array['thumbnail'] = array(); $image_id = get_post_thumbnail_id($post->ID); $image_attributes = wp_get_attachment_image_src($image_id, 'small'); $post_array['thumbnail']['small'] = $image_attributes[0]; $post_array['excerpt'] = get_excerpt($excerptLength, $excerptStyleOption, $post); $post_array['title'] = get_title($titleLength, $post); $post_array['updated'] = get_the_modified_date('M j, Y'); $results[] = $post_array; } echo json_encode($results); die(1); }
<article class="water-tile"> <a href="<?php the_permalink(); ?> " class="water-block" style="background-image: url('<?php echo $thumb_url; ?> ');"> <h1 class="trip-title"><?php the_title(); ?> </h1> </a> <div class="water-summary"> <p><?php echo get_excerpt(120); ?> </p> <span class="water-detail water-species"><strong>FISH SPECIES:</strong> <?php echo $water_species; ?> </span> <span class="water-detail water-trips"><strong>TRIP TYPES:</strong> <?php echo $water_trips; ?> </span> </div> </article> </div> <?php
function widget($args, $instance) { global $post; $posts = get_field('posts', 'widget_' . $args['widget_id']); $size = $instance['size']; if ($posts) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . $instance['title'] . $args['after_title']; ?> <?php if (!empty($instance['description'])) { ?> <div class="widget-description"><?php echo $instance['description']; ?> </div> <?php } ?> <?php } ?> <ul class="posts size-<?php echo $size; ?> "> <?php foreach ($posts as $post) { ?> <?php setup_postdata($post); ?> <?php $class = array($instance['size']); $class[] = has_post_thumbnail() ? 'has-thumbnail' : ''; switch ($size) { case 'small': $image_size = array('width' => 100, 'height' => 100); $title = get_the_title(); break; case 'medium': $image_size = array('width' => 65, 'height' => 65); $title = strlen(get_the_title()) > 25 ? substr(get_the_title(), 0, 25) . ' ...' : get_the_title(); break; case 'large': default: $image_size = array('width' => 200, 'height' => 200); $title = get_the_title(); break; } ?> <li <?php post_class(); ?> > <?php include_module('post-item', array('title' => $title, 'excerpt' => get_excerpt(50), 'url' => get_permalink(), 'image_url' => get_post_thumbnail_src($image_size), 'class' => implode(' ', $class))); ?> </li> <?php } ?> </ul> <?php echo $args['after_widget']; wp_reset_postdata(); wp_reset_query(); } }
?> </h1> <p class="metatext metatext-byline"> By <?php the_author_posts_link(); ?> / <a href="<?php the_archive_date(); ?> "><?php the_time('F j, Y'); ?> </a> </p> <p class="excerpt"><?php get_excerpt(500); ?> </p> </sidebar> <?php } ?> </main> <div class="hline hline-medium"></div> <section class="row"> <main class="main vline-medium"> <?php $displays = array('video' => 'videos', 'gallery' => 'galleries', 'audio' => 'audio'); ?> <?php
?> </h1> <div class="entry-date"><?php the_time('D m/d'); ?> </div> </div> <div class="upper-right"> <div class="entry-comments"><?php comments_number(); ?> </div> </div> <div class="loop-lower"> <div><?php echo get_excerpt(180); ?> </div> </div> </div> </a> </article> <?php } ?> <div class="clear"></div> <?php if ($wp_query->max_num_pages > 1) { ?>
$args = array('cat' => 6, 'posts_per_page' => 6, 'orderby' => 'date', 'order' => 'DESC'); $query = new WP_Query($args); while ($query->have_posts()) { $query->the_post(); ?> <article class="tip"> <div class="content"> <h3><a href="<?php echo get_permalink(); ?> "><?php echo the_title(); ?> </a></h3> <p><?php echo get_excerpt(140); ?> </p> </div> </article> <?php } wp_reset_postdata(); ?> </div> </section> <?php } ?>
<!--Our Team Section--> <section class="team-section"> <div class="auto-container"> <!--Section Title--> <div class="sec-title"> <h2>Latest news</h2> </div> <div class="team-slider-outer"> <!--Team Slider--> <div class="team-slider"> <?php foreach ($newss as $news) { $news = get_excerpt($news, 30); ?> <!--Member--> <article class="member-column"> <div class="inner-box"> <div class="member-title"> <h4><?php echo $news['title']; ?> </h4> <p><?php echo $news['pubdate']; ?> </p> </div> <div class="member-desc">
the_title(); ?> </a> </h3> <p class="metatext metatext-byline small-text">By <?php the_author_posts_link(); ?> / <a href="<?php the_archive_date(); ?> "><?php the_time('F j, Y'); ?> </a></p> <p class="excerpt"><?php get_excerpt(); ?> </p> </div> </article> <?php } ?> <div class="hline hline-medium"></div> <nav class="row"> <span class="metatext metatext-colored left"><?php previous_posts_link('< NEWER'); ?> </span> <span class="metatext metatext-colored right"><?php next_posts_link('OLDER >');
</div> <!--/.image-video--> <div class="content"> <h3><a href="<?php echo get_the_permalink(); ?> "><?php echo get_title(25); ?> </a></h3> <p class="updated"><?php the_modified_date('M j, Y'); ?> </p> <p><?php echo get_excerpt(80); ?> </p> </div> <!--/.content--> </article> <?php //endwhile; wp_reset_postdata(); } wp_reset_postdata(); ?> <a href="#" id="btn-show-more">Show More</a> </section> <!--/#view-all-container--> <div class="clear"></div> </section>
echo base_url(); ?> public/images/background/title_bg.jpg);"> <div class="auto-container"> <h1>News</h1> </div> </section> <!--Featured Three Column--> <section class="default-section featured-three-col"> <div class="auto-container"> <div class="row clearfix"> <?php if (count($newss)) { foreach ($newss as $client) { $news = get_excerpt($client); ?> <!--Column--> <div class="col-md-4 col-sm-6 col-xs-12 column"> <article class="inner-box"> <div class="content"> <h3><a href="#"><?php echo $news['title']; ?> </a></h3> <div class="text"><p><?php echo $news['body']; ?> </p></div> <div class="text-right"><a href="<?php echo site_url() . 'news/' . $client->id . '/' . $client->slug;
if (isset($articles[0])) { echo get_excerpt($articles[0]); } ?> </div> </div> <div class="row"> <div class="span5"><?php if (isset($articles[1])) { echo get_excerpt($articles[1]); } ?> </div> <div class="span4"><?php if (isset($articles[2])) { echo get_excerpt($articles[2]); } ?> </div> </div> </div> <!-- Sidebar --> <div class="span3 sidebar"> <h2>Recent news</h2> <?php echo anchor($news_archive_link, '+ News archive'); $articles = array_slice($articles, 3); echo article_links($articles); ?> </div>
$summary = $html; } else { // Try to get first few paragraphs if (isset($content_block) && $content_block instanceof DOMElement) { $_paras = $content_block->getElementsByTagName('p'); foreach ($_paras as $_para) { $summary .= preg_replace("/[\n\r\t ]+/", ' ', $_para->textContent) . ' '; if (strlen($summary) > 200) { break; } } } else { $summary = $html; } } $summary = get_excerpt($summary); $newitem->setDescription($summary); if ($options->content) { $newitem->setElement('content:encoded', $html); } unset($_paras, $_para, $content_block); } else { if ($options->content) { $newitem->setDescription($html); } unset($content_block); } // set date if ((int) $item->get_date('U') > 0) { $newitem->setDate((int) $item->get_date('U')); } elseif ($extractor->getDate()) {
" class="work-item overlay-btn-white"> <img src="<?php echo get_post_thumbnail_src($image_size); ?> " alt="<?php echo get_the_title(); ?> "/> <figcaption> <div> <h2><?php echo get_the_title(); ?> </h2> <p><?php echo get_excerpt(50); ?> </p> <span class="icon icon-right"></span> </div> </figcaption> </a> </li> <?php $i++; } // end of the loop. ?> </ul> <?php