• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_the_excerpt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_the_excerpt函数的典型用法代码示例。如果您正苦于以下问题:PHP get_the_excerpt函数的具体用法?PHP get_the_excerpt怎么用?PHP get_the_excerpt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_the_excerpt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: hvboom_get_portfolio

function hvboom_get_portfolio()
{
    $portfolio = '<section class="hvboom-portfolio">' . PHP_EOL;
    $args = "post_type=portfolio";
    $catalog = new WP_Query($args);
    while ($catalog->have_posts()) {
        $catalog->the_post();
        $img = hvboom_get_image();
        $portfolio .= '  <article>' . PHP_EOL;
        $portfolio .= '    <div class="styling-wrapper">' . PHP_EOL;
        $portfolio .= $img;
        $portfolio .= '      <header><h1>';
        $portfolio .= sprintf('<a href="%s" rel="bookmark">', esc_url(get_permalink())) . get_the_title() . '</a>';
        $portfolio .= '</h1></header>' . PHP_EOL;
        $portfolio .= '      <section>' . get_the_excerpt() . '</section>' . PHP_EOL;
        $portfolio .= '      <hr />' . PHP_EOL;
        $portfolio .= '      <footer>' . PHP_EOL;
        $portfolio .= sprintf('      <a href="%s" class="" role="button">', esc_url(get_permalink())) . __('View Project', 'hvboom') . '</a>' . PHP_EOL;
        $portfolio .= '      </footer>' . PHP_EOL;
        $portfolio .= '    </div> <!-- end of styling-wrapper -->' . PHP_EOL;
        $portfolio .= '  </article>' . PHP_EOL;
        $portfolio .= '  <smart-break></smart-break> <!-- styling element used only to break article in a responsive way -->' . PHP_EOL;
    }
    wp_reset_postdata();
    $portfolio .= '</section>' . PHP_EOL;
    return $portfolio;
}
开发者ID:HVboom,项目名称:hvboom-portfolio,代码行数:27,代码来源:hvboom-portfolio-cpt.php


示例2: getRecent

 /**
  * Latest blog posts
  *
  * @param int    $limit post display limit
  *
  * @param string $thumbnail_size
  *
  * @return array
  */
 public static function getRecent($limit = 10, $thumbnail_size = 'thumbnail')
 {
     $args = array('numberposts' => $limit, 'offset' => 0, 'category' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'include' => '', 'exclude' => '', 'meta_key' => '', 'meta_value' => '', 'post_type' => 'post', 'post_status' => 'draft, publish, future, pending', 'suppress_filters' => true);
     $array_out = array();
     $recent_posts = \get_posts(\wp_parse_args($args));
     /*$like_bool    = Option::get_theme_option( 'blog_list_like' );
       if ( $like_bool === '1' ) {
           $PostLike = \SilverWp\Ajax\PostLike::getInstance();
       }*/
     foreach ($recent_posts as $key => $recent) {
         \setup_postdata($recent);
         $post_id = $recent->ID;
         //$array_out[ $key ] = $recent;
         $array_out[$key]['ID'] = $post_id;
         $array_out[$key]['post_title'] = \get_the_title($post_id);
         $array_out[$key]['url'] = \get_the_permalink($post_id);
         $array_out[$key]['post_author'] = \get_the_author();
         $array_out[$key]['post_date'] = \get_the_date('', $post_id);
         $array_out[$key]['post_date_utc'] = \get_the_time('c', $post_id);
         //$array_out[ $key ]['post_like'] = ($like_bool === '1') ? $PostLike->getPostLikeCount($post_id) : '';
         $array_out[$key]['post_comment_count'] = $recent->comment_count;
         if (strpos($recent->post_content, '<!--more-->') || empty($recent->post_excerpt)) {
             $array_out[$key]['post_excerpt'] = \get_the_excerpt();
         } else {
             $array_out[$key]['post_excerpt'] = $recent->post_excerpt;
         }
         $array_out[$key]['image_html'] = \get_the_post_thumbnail($post_id, $thumbnail_size);
         // Thumbnail
         $array_out[$key]['categories'] = self::getTaxonomy($post_id);
     }
     \wp_reset_postdata();
     return $array_out;
 }
开发者ID:silversite,项目名称:silverwp,代码行数:42,代码来源:Post.php


示例3: blog_summary_shortcode

function blog_summary_shortcode($attr)
{
    // Describes what attributes to parse from shortcode; only 'count'
    extract(shortcode_atts(array('count' => '5', 'grouptag' => 'ul', 'entrytag' => 'li', 'titletag' => 'h4', 'datetag' => 'span', 'commentstag' => 'span', 'summarytag' => 'div'), $attr));
    // Queries to populate our loop based on shortcode count attribute
    $r = new WP_Query("showposts={$count}&what_to_show=posts&nopaging=0&post_status=publish");
    // Only run if we have posts; can't run this through searches
    if ($r->have_posts() && !is_search()) {
        // If we're using a Sandbox-friendly theme . . .
        if (function_exists('sandbox_body_class')) {
            // We can't have double hfeed classes, otherwise it won't parse
            $groupclasses = 'xoxo';
        } else {
            // Otherwise, use hfeed to ensure hAtom compliance
            $groupclasses = 'xoxo hfeed';
        }
        // Begin the output for shortcode and inserts in the group tag what classes we have
        $output = '<' . $grouptag . ' class="' . $groupclasses . '">';
        // Begins our loop for returning posts
        while ($r->have_posts()) {
            // Sets which post from our loop we're at
            $r->the_post();
            // Allows the_date() with multiple posts within a single day
            unset($previousday);
            // If we're using a Sandbox-friendly theme . . .
            if (function_exists('sandbox_post_class')) {
                // Let's use semantic classes with each entry element
                $entryclasses = sandbox_post_class(false);
            } else {
                // Otherwise, use hentry to ensure hAtom compliance
                $entryclasses = 'hentry';
            }
            // Begin entry wrapper and inserts what classes we got from above
            $output .= "\n" . '<' . $entrytag . ' class="' . $entryclasses . '">';
            // Post title
            $output .= "\n" . '<' . $titletag . ' class="entry-title"><a href="' . get_permalink() . '" title="' . sprintf(__('Permalink to %s', 'blog_summary'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a></' . $titletag . '>';
            // Post date with hAtom support
            $output .= "\n" . '<' . $datetag . ' class="entry-date"><abbr class="published" title="' . get_the_time('Y-m-d\\TH:i:sO') . '">' . sprintf(__('%s', 'blog_summary'), the_date('', '', '', false)) . '</abbr></' . $datetag . '>';
            // Comments number
            $output .= "\n" . '<' . $commentstag . ' class="entry-comments"><a href="' . get_permalink() . '#comments" title="' . sprintf(__('Comments to %s', 'blog_summary'), the_title_attribute('echo=0')) . '">' . sprintf(__('Comments (%s)', 'blog_summary'), apply_filters('comments_number', get_comments_number())) . '</a></' . $commentstag . '>';
            // Post excerpt with hAtom support
            $output .= "\n" . '<' . $summarytag . ' class="entry-summary">' . "\n" . apply_filters('the_excerpt', get_the_excerpt()) . '</' . $summarytag . '>';
            // Close each post LI
            $output .= "\n" . '</' . $entrytag . '>';
            // Finish the have_posts() query
        }
        // while ( $r->have_posts() ) :
        // Close the parent UL
        $output .= "\n" . '</' . $grouptag . '>';
        // Rewinds loop from $r->the_post();
        rewind_posts();
        // End the initial IF statement
    }
    // if ( $r->have_posts() ) :
    // Clears our query to put the loop back where it was
    wp_reset_query();
    // $r = new WP_Query()
    // Returns $output to the shortcode
    return $output;
}
开发者ID:Turante,项目名称:wp-plugin-dev,代码行数:60,代码来源:blog-summary.php


示例4: porto_get_excerpt

function porto_get_excerpt($limit = 45, $more_link = true)
{
    global $porto_settings;
    if (!$limit) {
        $limit = 45;
    }
    if (has_excerpt()) {
        $content = strip_tags(strip_shortcodes(get_the_excerpt()));
    } else {
        $content = strip_tags(strip_shortcodes(get_the_content()));
    }
    $content = explode(' ', $content, $limit);
    if (count($content) >= $limit) {
        array_pop($content);
        if ($more_link) {
            $content = implode(" ", $content) . '... ';
        } else {
            $content = implode(" ", $content) . ' [...]';
        }
    } else {
        $content = implode(" ", $content);
    }
    if ($porto_settings['blog-excerpt-type'] == 'html') {
        $content = apply_filters('the_content', $content);
        $content = do_shortcode($content);
    }
    if ($more_link) {
        $content .= ' <a class="read-more" href="' . esc_url(apply_filters('the_permalink', get_permalink())) . '">' . __('read more', 'porto') . ' <i class="fa fa-angle-right"></i></a>';
    }
    if ($porto_settings['blog-excerpt-type'] != 'html') {
        $content = '<p class="post-excerpt">' . $content . '</p>';
    }
    return $content;
}
开发者ID:prosenjit-itobuz,项目名称:Unitee,代码行数:34,代码来源:post.php


示例5: cfct_about_text

function cfct_about_text()
{
    $about_text = get_option('cfct_about_text');
    if (!empty($about_text)) {
        $about_text = cfct_basic_content_formatting($about_text);
    } else {
        global $post, $wp_query;
        $orig_post = $post;
        isset($wp_query->query_vars['page']) ? $page = $wp_query->query_vars['page'] : ($page = null);
        // temporary - resetting below
        $wp_query->query_vars['page'] = null;
        remove_filter('the_excerpt', 'st_add_widget');
        $about_query = new WP_Query('pagename=about');
        while ($about_query->have_posts()) {
            $about_query->the_post();
            $about_text = get_the_excerpt() . sprintf(__('<a class="more" href="%s">more &rarr;</a>', 'carrington'), get_permalink());
        }
        $wp_query->query_vars['page'] = $page;
        $post = $orig_post;
        setup_postdata($post);
    }
    if (function_exists('st_add_widget')) {
        add_filter('the_excerpt', 'st_add_widget');
    }
    return $about_text;
}
开发者ID:Linuxwang,项目名称:PIE,代码行数:26,代码来源:carrington.php


示例6: todays_movies

function todays_movies()
{
    $todays_movies = array();
    $args = array('post_type' => array('film'), 'posts_per_page' => -1);
    $query = new WP_Query($args);
    if ($query->have_posts()) {
        while ($query->have_posts()) {
            $query->the_post();
            $schedule = get_post_meta(get_the_ID(), 'film_horaire', true);
            $duration = get_post_meta(get_the_ID(), 'film_duration', true);
            //the_title();
            //piklist::pre($schedule);
            foreach ($schedule as $key) {
                //echo $key['film_date'] . '<br>';
                $movie_iso_date = DateTime::createFromFormat('d/m/Y', $key['film_date'])->format('Y-m-d');
                //echo $movie_iso_date . '<br>';
                if (date('Y-m-d') == $movie_iso_date) {
                    $director = get_the_terms($post->ID, 'director');
                    $countries = get_the_terms($post->ID, 'country');
                    $languages = get_the_terms($post->ID, 'language');
                    $year = get_the_terms($post->ID, 'film-year');
                    $format = get_the_terms($post->ID, 'format');
                    $featured_image = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID()));
                    $film_detail = array('id' => get_the_ID(), 'image' => $featured_image, 'title' => get_the_title(), 'duration' => $duration, 'excerpt' => get_the_excerpt(), 'link' => get_permalink(), 'date' => $movie_iso_date, 'hour' => $key['film_heure'], 'director' => $director, 'country' => $countries, 'language' => $languages, 'year' => $year, 'format' => $format);
                    array_push($todays_movies, $film_detail);
                }
            }
        }
        wp_reset_postdata();
    }
    return $todays_movies;
}
开发者ID:gabzon,项目名称:spoutnik,代码行数:32,代码来源:sorting.php


示例7: description

function description()
{
    if (is_home() || is_front_page()) {
        echo trim(of_get_option('site_description'));
    } elseif (is_category()) {
        $description = strip_tags(category_description());
        echo trim($description);
    } elseif (is_single()) {
        if (get_the_excerpt()) {
            echo get_the_excerpt();
        } else {
            global $post;
            $description = trim(str_replace(array("\r\n", "\r", "\n", " ", " "), " ", str_replace("\"", "'", strip_tags($post->post_content))));
            echo mb_substr($description, 0, 220, 'utf-8');
        }
    } elseif (is_search()) {
        echo '“';
        the_search_query();
        echo '”为您找到结果 ';
        global $wp_query;
        echo $wp_query->found_posts;
        echo ' 个';
    } elseif (is_tag()) {
        $description = strip_tags(tag_description());
        echo trim($description);
    } else {
        $description = strip_tags(term_description());
        echo trim($description);
    }
}
开发者ID:carpliyz,项目名称:9IPHP,代码行数:30,代码来源:header.php


示例8: get_skills_registration

function get_skills_registration($atts)
{
    $string = '';
    //$attributes = shortcode_atts( array(), $atts ); //get attributes
    $args = array('posts_per_page' => -1, 'post_type' => 'skeleton_skill', 'orderby' => 'menu_order', 'order' => 'ASC');
    $skills = get_posts($args);
    global $post;
    $string .= "<h3 class='shortcode-title'>Skills</h3>";
    $i = 0;
    foreach ($skills as $post) {
        $i++;
        if ($i % 2 == 0) {
            $class = 'right';
        } else {
            $class = 'left';
        }
        setup_postdata($post);
        $bg_image_url = '"' . wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full') . '"';
        $content = get_the_excerpt();
        $title = get_the_title();
        $link = get_the_permalink();
        $string .= "<div class='skill-container' style='background-image: url({$bg_image_url})'>";
        $string .= "<a class='skill-link' href='{$link}' title='{$title}'></a>";
        $string .= "<div class='skill-content {$class}'>";
        $string .= "<h4>{$title}</h4>";
        $string .= "<div class='description'>{$content}</div>";
        $string .= "</div>";
        //skill-content
        $string .= "</div>";
        //skill-container
    }
    wp_reset_query();
    return $string;
}
开发者ID:adamgiese,项目名称:portfoliage-theme,代码行数:34,代码来源:skills.php


示例9: arras_get_thumbnail

/**
 * Helper function to grab and display thumbnail from specified post
 * @since 1.4.0
 */
function arras_get_thumbnail($size = 'thumbnail', $id = NULL)
{
    global $post, $arras_image_sizes;
    $empty_thumbnail = '<img src="' . get_template_directory_uri() . '/images/thumbnail.png" alt="' . get_the_excerpt() . '" title="' . get_the_title() . '" />';
    if ($post) {
        $id = $post->ID;
    }
    // get post thumbnail (WordPress 2.9)
    if (function_exists('has_post_thumbnail')) {
        if (has_post_thumbnail($id)) {
            return get_the_post_thumbnail($id, $size, array('alt' => get_the_excerpt(), 'title' => get_the_title()));
        } else {
            // Could it be an attachment?
            if ($post->post_type == 'attachment') {
                return wp_get_attachment_image($id, $size, false, array('alt' => get_the_excerpt(), 'title' => get_the_title()));
            }
            // Use first thumbnail if auto thumbs is enabled.
            if (arras_get_option('auto_thumbs')) {
                $img_id = arras_get_first_post_image_id();
                if (!$img_id) {
                    return $empty_thumbnail;
                }
                return wp_get_attachment_image($img_id, $size, false, array('alt' => get_the_excerpt(), 'title' => get_the_title()));
            }
        }
    }
    return $empty_thumbnail;
}
开发者ID:rosshettel,项目名称:Northern-Star-Blogs,代码行数:32,代码来源:thumbnails.php


示例10: ipin_opengraph

function ipin_opengraph()
{
    if (is_single()) {
        global $post;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . preg_replace('/[\\n\\r]/', ' ', the_title_attribute('echo=0')) . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
        $output .= '<meta property="og:description" content="' . esc_attr(get_the_excerpt()) . '" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
    if (is_tax('board')) {
        global $post, $wp_query;
        setup_postdata($post);
        $output = '<meta property="og:type" content="article" />' . "\n";
        $output .= '<meta property="og:title" content="' . $wp_query->queried_object->name . '" />' . "\n";
        $output .= '<meta property="og:url" content="' . home_url('/board/') . $wp_query->queried_object->term_id . '/" />' . "\n";
        $output .= '<meta property="og:description" content="" />' . "\n";
        if (has_post_thumbnail()) {
            $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'large');
            $output .= '<meta property="og:image" content="' . $imgsrc[0] . '" />' . "\n";
        }
        echo $output;
    }
}
开发者ID:evinw,项目名称:project_modelv,代码行数:29,代码来源:functions.php


示例11: register_meta_tags

 public function register_meta_tags()
 {
     add_action('wp_head', function () {
         if (is_singular() && false == post_password_required()) {
             if ('' == ($description = get_the_excerpt())) {
                 $description = wp_trim_words(esc_html(strip_shortcodes(get_the_content())), 20, '...');
             }
         } elseif (is_category() && '' != category_description()) {
             $description = category_description();
         } elseif (is_tag() && '' != term_description()) {
             $description = term_description();
         } else {
             $description = get_bloginfo('description');
         }
         $description = esc_attr($description);
         echo "<meta name=\"description\" content=\"{$description}\" />\n";
         echo "<meta name=\"og:description\" content=\"{$description}\" />\n";
         if (is_singular() && false == post_password_required() && has_post_thumbnail()) {
             list($image, $width, $height) = wp_get_attachment_image_src(get_post_thumbnail_id(), 'facebook');
         } else {
             $image = apply_filters('', $this->get_theme_assets_url() . '/images/logo-fb.png');
         }
         $image = esc_url($image);
         echo "<meta name=\"og:image\" content=\"{$image}\" />\n";
         echo "<meta name=\"twitter:image\" content=\"{$image}\" />\n";
     });
 }
开发者ID:shtrihstr,项目名称:wpk15-theme-wpkit,代码行数:27,代码来源:Initialization.php


示例12: find_post

 function find_post()
 {
     $this->verify_ajax_call();
     $q = $_GET['query'];
     $the_query = new WP_Query('s=' . $q);
     //$response = array('empty','test');
     $d = new stdClass();
     $d->query = $q;
     $d->suggestions = array();
     $d->data = array();
     // The Loop
     global $post;
     while ($the_query->have_posts()) {
         $the_query->the_post();
         $d->suggestions[] = get_the_title();
         $content = get_the_content();
         $content = apply_filters('the_content', $content);
         $content = str_replace(']]>', ']]&gt;', $content);
         $d->data[] = array("content" => $content, "excerpt" => get_the_excerpt(), "url" => get_permalink());
     }
     // Reset Post Data
     wp_reset_postdata();
     // Serialize the response back as JSON
     echo json_encode($d);
     die;
 }
开发者ID:richardsweeney,项目名称:sendpress,代码行数:26,代码来源:class-sendpress-ajax-loader.php


示例13: sequence_slider_display

function sequence_slider_display($atts)
{
    extract(shortcode_atts(array('limit' => 10), $atts));
    $args = array('post_type' => 'sequence-slider', 'posts_per_page' => $limit);
    // The Query
    $the_query = new WP_Query($args);
    $html = null;
    // The Loop
    if ($the_query->have_posts()) {
        $html .= '<div class="sequence-theme">';
        $html .= '<div class="sequence">';
        $html .= '<img class="sequence-prev" src="' . SEQUENCE_PLUGIN_URL . 'images/bt-prev.png" alt="Previous Frame" />';
        $html .= '<img class="sequence-next" src="' . SEQUENCE_PLUGIN_URL . 'images/bt-next.png" alt="Next Frame" />';
        $html .= '<ul class="sequence-canvas">';
        while ($the_query->have_posts()) {
            $the_query->the_post();
            //echo "<pre>";
            //print_r($the_query);
            $html .= '<li class="animate-in">';
            $html .= '<h3 class="title">' . get_the_title() . '</h3>';
            $html .= '<h4 class="subtitle">' . get_the_excerpt() . '';
            $html .= '<a class="slider_link" href="' . get_post_meta($the_query->post->ID, '_link', true) . '">' . get_post_meta($the_query->post->ID, '_text', true) . '</a></h4>';
            $html .= get_the_post_thumbnail($the_query->post->ID, 'full', array('class' => 'model'));
            $html .= '</li>';
        }
        $html .= '</ul>';
        //$html .= '<ul class="sequence-pagination"></ul>';
        $html .= '</div></div>';
    } else {
        // no posts found
    }
    /* Restore original Post Data */
    wp_reset_postdata();
    return $html;
}
开发者ID:azeemgolive,项目名称:thefunkidsgame,代码行数:35,代码来源:functions.php


示例14: queryAndResponse

 protected function queryAndResponse($arg)
 {
     $the_query = new WP_Query($arg);
     if ($the_query->have_posts()) {
         $counter = 0;
         $items = array();
         while ($the_query->have_posts()) {
             $the_query->the_post();
             global $post;
             $title = get_the_title();
             $link = get_permalink();
             $excerpt = wechat_get_excerpt(get_the_excerpt());
             if ($counter == 0) {
                 $thumb = wechat_get_thumb($post, array(640, 320));
             } else {
                 $thumb = wechat_get_thumb($post, array(80, 80));
             }
             $new_item = new NewsResponseItem($title, $excerpt, $thumb, $link);
             array_push($items, $new_item);
             // 最多显示3篇
             if (++$counter == 3) {
                 break;
             }
         }
         $this->responseNews($items);
     } else {
         $this->responseText("不好意思~没有找到您想要的东东~请换个关键字再试试?");
     }
     wp_reset_postdata();
 }
开发者ID:qinzhe,项目名称:wechat-robot,代码行数:30,代码来源:wechat-robot.php


示例15: slickc_load_images

function slickc_load_images($attributes)
{
    $args = array('post_type' => 'slickc', 'posts_per_page' => '-1', 'orderby' => $attributes['orderby'], 'order' => $attributes['order']);
    if (!empty($attributes['category'])) {
        $args['carousel_category'] = $attributes['category'];
    }
    if (!empty($attributes['id'])) {
        $args['p'] = $attributes['id'];
    }
    $loop = new WP_Query($args);
    $images = array();
    $output = '';
    while ($loop->have_posts()) {
        $loop->the_post();
        $image = get_the_post_thumbnail(get_the_ID(), 'full');
        if (!empty($image)) {
            $post_id = get_the_ID();
            $title = get_the_title();
            $content = get_the_excerpt();
            $image_src = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
            $image_src = $image_src[0];
            $url = get_post_meta(get_the_ID(), 'slickc_image_url');
            $url_openblank = get_post_meta(get_the_ID(), 'slickc_image_url_openblank');
            $images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'img_src' => $image_src, 'url' => esc_url($url[0]), 'open_blank' => $url_openblank[0]);
        }
    }
    return $images;
}
开发者ID:jgacuca567,项目名称:bethel,代码行数:28,代码来源:slick-frontend.php


示例16: register_shortcode

 public function register_shortcode()
 {
     $loop = new WP_Query(array('post_type' => 'selcont_lecture_type', 'orderby' => 'title'));
     if ($loop->have_posts()) {
         $output = '<div class="lectures-list">';
         while ($loop->have_posts()) {
             $loop->the_post();
             $meta = get_post_meta(get_the_id(), '');
             $output .= '
                     <h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>
                     <div>
                     <strong>' . $meta['instructor_name_meta_box'][0] . '</strong>
                     <br/>
                     ' . get_the_excerpt() . '
                     </div>
                     <hr/>
                     <br/><br/>
             ';
         }
         $output .= '</div>';
     } else {
         $output = 'No Lectures Found.';
     }
     return $output;
 }
开发者ID:aandreatos,项目名称:selcont,代码行数:25,代码来源:class-selcont-public.php


示例17: wpb_latest_sticky

function wpb_latest_sticky()
{
    /* Get all sticky posts */
    $sticky = get_option('sticky_posts');
    /* Sort the stickies with the newest ones at the top */
    rsort($sticky);
    /* Get the 5 newest stickies (change 5 for a different number) */
    $sticky = array_slice($sticky, 0, 1);
    /* Query sticky posts */
    $the_query = new WP_Query(array('post__in' => $sticky, 'ignore_sticky_posts' => 1));
    // The Loop
    $arr = array();
    if ($the_query->have_posts()) {
        while ($the_query->have_posts()) {
            $the_query->the_post();
            $arr['permlink'] = get_permalink("", "", false);
            $arr['title'] = get_the_title("", "", false);
            $arr['excerpt'] = get_the_excerpt("", "", false);
            $arr['img_url'] = get_the_post_thumbnail_url();
        }
    } else {
        // no posts found
        $arr['excerpt'] = $arr['title'] = $arr['permlink'] = $arr["img_url"] = "404 not found any featured post ! :( ";
    }
    /* Restore original Post Data */
    wp_reset_postdata();
    return $arr;
}
开发者ID:duongcuong96,项目名称:my-wp-themes,代码行数:28,代码来源:functions.php


示例18: load_dummy

function load_dummy()
{
    wp_enqueue_style('dummy-style', get_stylesheet_uri());
    wp_enqueue_script('dummy-js', get_template_directory_uri() . '/js/dummy.js');
    $slide_data = array();
    $the_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 6));
    while ($the_query->have_posts()) {
        $the_query->the_post();
        $has_thumb = false;
        $thumb_url;
        if (has_post_thumbnail()) {
            $has_thumb = true;
            $thumb_url = wp_get_attachment_url(get_post_thumbnail_id());
        } else {
            $thumb_url = null;
        }
        $link = esc_url(get_permalink());
        $title = get_the_title();
        $excerpt = get_the_excerpt();
        array_push($slide_data, array('hasThumb' => $has_thumb, 'thumbUrl' => $thumb_url, 'link' => $link, 'title' => $title, 'excerpt' => $excerpt));
    }
    $popup_data = array('enable' => get_option('show_popup'), 'imageUrl' => esc_url(get_theme_mod('popup_image')));
    wp_localize_script('dummy-js', 'slideData', $slide_data);
    wp_localize_script('dummy-js', 'popupData', $popup_data);
}
开发者ID:yulapshun,项目名称:pensionhk-wordpress-theme,代码行数:25,代码来源:functions.php


示例19: ar2_get_thumbnail

/**
 * Helper function to grab and display thumbnail from specified post
 * @since 1.4.0
 */
function ar2_get_thumbnail($size = 'thumbnail', $id = NULL, $attr = array())
{
    global $post, $ar2_image_sizes;
    if ($post) {
        $id = $post->ID;
    }
    if (!key_exists('alt', $attr)) {
        $attr['alt'] = esc_attr(get_the_excerpt());
    }
    if (!key_exists('title', $attr)) {
        $attr['title'] = esc_attr(get_the_title());
    }
    if (has_post_thumbnail($id)) {
        return get_the_post_thumbnail($id, $size, $attr);
    } else {
        // Could it be an attachment?
        if ($post->post_type == 'attachment') {
            return wp_get_attachment_image($id, $size, false, $attr);
        }
        // Use first thumbnail if auto thumbs is enabled.
        if (ar2_get_theme_option('auto_thumbs')) {
            $img_id = ar2_get_first_post_image_id();
            if ($img_id) {
                return wp_get_attachment_image($img_id, $size, false, $attr);
            }
        }
    }
    // Return empty thumbnail if all else fails.
    return '<img src="' . get_template_directory_uri() . '/images/empty_thumbnail.gif" alt="' . $attr['alt'] . '" title="' . $attr['title'] . '" />';
}
开发者ID:SublimeCoralie,项目名称:project-ar2,代码行数:34,代码来源:thumbnails.php


示例20: widget

 function widget($args, $instance)
 {
     extract($args);
     /* User-selected settings. */
     $title = apply_filters('widget_title', $instance['title']);
     $category = $instance['category'];
     $show_count = $instance['show_count'];
     $show_date = $instance['show_date'] ? true : false;
     $show_thumb = $instance['show_thumb'] ? true : false;
     $show_excerpt = $instance['show_excerpt'] ? true : false;
     $excerpt_length = $instance['excerpt_length'];
     $show_title = $instance['hide_title'] ? false : true;
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Title of widget (before and after defined by themes). */
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<ul class="wpzoom-feature-posts">';
     $query_opts = apply_filters('wpzoom_query', array('posts_per_page' => $show_count, 'post_type' => 'post'));
     if ($category) {
         $query_opts['cat'] = $category;
     }
     query_posts($query_opts);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             echo '<li>';
             if ($show_thumb) {
                 $custom_field = option::get('cf_use') == 'on' ? get_post_meta($post->ID, option::get('cf_photo'), true) : '';
                 $args = array('size' => 'recent-widget', 'width' => $instance['thumb_width'], 'height' => $instance['thumb_height']);
                 if ($custom_field) {
                     $args['meta_key'] = option::get('cf_photo');
                 }
                 get_the_image($args);
             }
             if ($show_title) {
                 echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>';
             }
             if ($show_date) {
                 echo '<small>' . get_the_date() . '</small>';
             }
             if ($show_excerpt) {
                 $the_excerpt = get_the_excerpt();
                 // cut to character limit
                 $the_excerpt = substr($the_excerpt, 0, $excerpt_length);
                 // cut to last space
                 $the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' '));
                 echo '<span class="post-excerpt">' . $the_excerpt . '</span>';
             }
             echo '<div class="clear"></div></li>';
         }
     } else {
     }
     //Reset query_posts
     wp_reset_query();
     echo '</ul><div class="clear"></div>';
     /* After widget (defined by themes). */
     echo $after_widget;
 }
开发者ID:aaronfrey,项目名称:PepperLillie-FiveVirtues,代码行数:60,代码来源:recentposts.php



注:本文中的get_the_excerpt函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_the_generator函数代码示例发布时间:2022-05-15
下一篇:
PHP get_the_date函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap