当前位置: 首页>>代码示例>>PHP>>正文


PHP the_content_limit函数代码示例

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


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

示例1: widget

 /**
  * Display widget content.
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, $this->defaults);
     $featured_page = new WP_Query(array('page_id' => $instance['page_id']));
     echo $before_widget . '<div class="feature-page">';
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     if ($featured_page->have_posts()) {
         while ($featured_page->have_posts()) {
             $featured_page->the_post();
             echo '<div class="' . implode(' ', get_post_class()) . '">';
             if (!empty($instance['show_title'])) {
                 printf('<h4 class="entry-title"><a href="%s" title="%s">%s</a></h4>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
             }
             //Show image
             if (!empty($instance['show_image'])) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), calibrefx_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
             }
             if (!empty($instance['show_content'])) {
                 if (empty($instance['content_limit'])) {
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
             }
             echo '</div><!--end post_class()-->' . "\n\n";
         }
     }
     echo '</div>' . $after_widget;
     wp_reset_query();
 }
开发者ID:alispx,项目名称:calibrefx,代码行数:39,代码来源:feature_page_widget.php

示例2: widget

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($instance['show_image'] && $image) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image);
             }
             if (!empty($instance['show_title'])) {
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 } else {
                     printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $more = 0;
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             if (!empty($instance['custom_text'])) {
                 $text = wp_kses_post($instance['custom_text']);
                 echo '<div class="custom-text">';
                 echo $instance['filter'] ? wpautop($text) : $text;
                 if (!empty($instance['more_text'])) {
                     echo '<span class="more-link"><a href="' . get_permalink($instance['page_id']) . '">' . $instance['more_text'] . '</a></span>';
                 }
                 echo '</div>';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:Bobcatou,项目名称:enhanceworldwide,代码行数:62,代码来源:wsm-featured-page.php

示例3: crystal_portfolio_do_post_content

function crystal_portfolio_do_post_content()
{
    if (genesis_get_option('crystal_portfolio_content') == 'excerpts') {
        the_excerpt();
    } else {
        if (genesis_get_option('crystal_portfolio_content_archive_limit')) {
            the_content_limit((int) genesis_get_option('crystal_portfolio_content_archive_limit'), __('View Project', 'crystal'));
        } else {
            the_content(__('View Project', 'crystal'));
        }
    }
}
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:12,代码来源:page_portfolio.php

示例4: widget

 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'posts_cat' => '', 'posts_num' => '', 'posts_offset' => '', 'orderby' => '', 'order' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => ''));
     echo $before_widget;
     $featured_posts = new WP_Query(array('cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']));
     if ($featured_posts->have_posts()) {
         while ($featured_posts->have_posts()) {
             $featured_posts->the_post();
             echo '<li ';
             post_class('feature-post');
             echo '>';
             if (!empty($instance['show_image'])) {
                 echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="' . esc_attr($instance['image_alignment']) . ' feature-image">';
                 genesis_image(array('format' => 'html', 'size' => $instance['image_size']));
                 echo '</a>';
             }
             if (!empty($instance['show_title'])) {
                 echo '<h2 class="title"><a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a></h2>';
             }
             if (!empty($instance['show_byline'])) {
                 echo '<p class="byline">';
                 the_time('F j, Y');
                 echo ' ' . __('by', 'genesis') . ' ';
                 the_author_posts_link();
                 echo ' &middot; ';
                 comments_popup_link(__('Leave a Comment', 'genesis'), __('1 Comment', 'genesis'), __('% Comments', 'genesis'));
                 echo ' ';
                 edit_post_link(__('(Edit)', 'genesis'), '', '');
                 echo '</p>';
             }
             if (!empty($instance['show_content'])) {
                 if ($instance['show_content'] == 'excerpt') {
                     the_excerpt();
                 } elseif ($instance['show_content'] == 'content-limit') {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 } else {
                     the_content(esc_html($instance['more_text']));
                 }
             }
             echo '</li><!--end post_class()-->' . "\n\n";
             if (!empty($instance['show_slider_nav'])) {
                 $slider_nav .= '<li><a href="#"></a></li>';
             }
         }
     }
     echo $after_widget;
     echo '<div class="feature-nav ' . esc_attr($instance['image_alignment']) . '">';
     echo '<ul>';
     echo $slider_nav;
     echo '</ul></div>';
     wp_reset_query();
 }
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:53,代码来源:lexicon-slider-widget.php

示例5: widget

 /**
  * Echo the widget content.
  *
  * @since 0.2.0
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Set up the widget title
     if (!empty($instance['title'])) {
         echo '<h2 class="widget-title widgettitle">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</h2>';
     }
     $query_args = array('post_type' => 'awp-community', 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']);
     $wp_query = new WP_Query($query_args);
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-community-widget', 'attr' => genesis_parse_attr('entry-image-widget')));
             if ($instance['show_image'] && $image) {
                 printf('<div class="awp-community-image"><a href="%s" title="%s" class="%s">%s</a></div>', get_permalink(), the_title_attribute('echo=0'), 'awp-community-link', $image);
             }
             if ($instance['show_title']) {
                 echo '<header class="entry-header">';
                 printf('<h3 class="entry-title"><a href="%s" title="%s">%s</a></h3>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 echo '</header>';
             }
             if (!empty($instance['show_content'])) {
                 echo '<div class="entry-content">';
                 if ('excerpt' == $instance['show_content']) {
                     $current_excerpt = get_the_excerpt();
                     echo $current_excerpt;
                     //the_excerpt();
                 } elseif ('content-limit' == $instance['show_content']) {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 } else {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(esc_html($instance['more_text']));
                     $more = $orig_more;
                 }
                 echo '</div>';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:jdelia,项目名称:genesis-communities-cpt,代码行数:58,代码来源:featured-awp-communities-widget.php

示例6: widget

 function widget($args, $instance)
 {
     extract($args);
     $instance = wp_parse_args((array) $instance, array('title' => '', 'page_id' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => ''));
     echo $before_widget;
     // Set up the author bio
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
     }
     $featured_page = new WP_Query(array('page_id' => $instance['page_id']));
     if ($featured_page->have_posts()) {
         while ($featured_page->have_posts()) {
             $featured_page->the_post();
             echo '<div ';
             post_class();
             echo '>';
             if (!empty($instance['show_image'])) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
             }
             if (!empty($instance['show_title'])) {
                 printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), the_title_attribute('echo=0'));
             }
             if (!empty($instance['show_byline'])) {
                 echo '<p class="byline">';
                 the_time('F j, Y');
                 echo ' ' . __('by', 'genesis') . ' ';
                 the_author_posts_link();
                 echo g_ent(' &middot; ');
                 comments_popup_link(__('Leave a Comment', 'genesis'), __('1 Comment', 'genesis'), __('% Comments', 'genesis'));
                 echo ' ';
                 edit_post_link(__('(Edit)', 'genesis'), '', '');
                 echo '</p>';
             }
             if (!empty($instance['show_content'])) {
                 if (empty($instance['content_limit'])) {
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
             }
             echo '</div><!--end post_class()-->' . "\n\n";
         }
     }
     echo $after_widget;
     wp_reset_query();
 }
开发者ID:Weissenberger13,项目名称:web.portugalrentalcottages,代码行数:46,代码来源:featured-page-widget.php

示例7: widget

 function widget($args, $instance)
 {
     extract($args);
     echo $before_widget;
     $slider_nav = '';
     $featured_posts = new WP_Query(array('cat' => $instance['posts_cat'], 'showposts' => $instance['posts_num'], 'offset' => $instance['posts_offset'], 'orderby' => $instance['orderby'], 'order' => $instance['order']));
     if ($featured_posts->have_posts()) {
         while ($featured_posts->have_posts()) {
             $featured_posts->the_post();
             echo '<li ';
             post_class('slider-post');
             echo '>';
             if (!empty($instance['show_image'])) {
                 echo '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="' . esc_attr($instance['image_alignment']) . ' slider-show-image">';
                 genesis_image(array('format' => 'html', 'size' => $instance['image_size']));
                 echo '</a>';
             }
             if (!empty($instance['show_title'])) {
                 echo '<h2 class="slider-title"><a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">' . get_the_title() . '</a></h2>';
             }
             if (!empty($instance['show_content'])) {
                 if ($instance['show_content'] == 'excerpt') {
                     the_excerpt();
                 } elseif ($instance['show_content'] == 'content-limit') {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 } else {
                     the_content(esc_html($instance['more_text']));
                 }
             }
             echo '</li><!--end post_class()-->' . "\n\n";
             if (!empty($instance['show_slider_nav'])) {
                 $slider_nav .= '<li><a href="#" class="nav-thumb-wrapper">' . genesis_get_image(array('format' => 'html', 'size' => 'Slider Thumbnail', 'attr' => array('class' => 'nav-thumb-image'))) . '</a></li>';
             }
         }
     }
     echo $after_widget;
     echo '<div id="slider-nav">';
     echo '<a class="nav-prev" href="#">Previous</a>';
     echo '<a class="nav-next" href="#">Next</a>';
     echo '<ul class="nav-thumbs">';
     echo $slider_nav;
     echo '</ul></div>';
     wp_reset_query();
 }
开发者ID:nmrugg,项目名称:studiopress-premum-wp-themes,代码行数:44,代码来源:delicious-slider-widget.php

示例8: widget

    function widget($args, $instance)
    {
        extract($args);
        $instance = wp_parse_args((array) $instance, array('title' => '', 'page_id' => '', 'show_title' => 0, 'show_content' => 0, 'content_limit' => '', 'more_text' => ''));
        echo $before_widget;
        // Set up the author bio
        if (!empty($instance['title'])) {
            echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
        }
        $featured_page = new WP_Query(array('page_id' => $instance['page_id']));
        if ($featured_page->have_posts()) {
            while ($featured_page->have_posts()) {
                $featured_page->the_post();
                echo '<div ';
                post_class();
                echo '>';
                ?>
				
				<a href="<?php 
                the_permalink();
                ?>
" rel="noindex"><?php 
                the_post_thumbnail();
                ?>
</a>
				
				<?php 
                if (!empty($instance['show_title'])) {
                    printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), the_title_attribute('echo=0'));
                }
                if (!empty($instance['show_content'])) {
                    if (empty($instance['content_limit'])) {
                        the_content($instance['more_text']);
                    } else {
                        the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                    }
                }
                echo '</div><!--end post_class()-->' . "\n\n";
            }
        }
        echo $after_widget;
        wp_reset_query();
    }
开发者ID:Ezyva2015,项目名称:money101.com.au,代码行数:43,代码来源:widget-featured-page.php

示例9: widget

 /**
  * Echo the widget content.
  *
  * @since 0.9.1
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     extract($args);
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $before_widget;
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             echo '<article class="' . implode(' ', get_post_class()) . ' entry" itemtype="http://schema.org/CreativeWork" itemscope="itemscope">';
             $image = omega_get_image(array('format' => 'html', 'size' => $instance['image_size']));
             if ($instance['show_image'] && $image) {
                 printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image);
             }
             if (!empty($instance['show_title'])) {
                 printf('<header class="entry-header"><h2 class="entry-title"><a href="%s" title="%s">%s</a></h2></header>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
             }
             if (!empty($instance['show_content'])) {
                 echo '<div class="entry-content">';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $more = 0;
                     the_content($instance['more_text']);
                 } else {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 }
                 echo '</div>';
             }
             echo '</article>';
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $after_widget;
 }
开发者ID:ninthlink,项目名称:edtech,代码行数:49,代码来源:widget-featured-page.php

示例10: widget


//.........这里部分代码省略.........
             } else {
                 $size = $instance['image_size'];
                 $image = apply_filters('featured_custom_post_type_image', genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-post-widget', 'attr' => genesis_parse_attr('entry-image-widget'))), $size);
                 if ($instance['show_image'] && $image) {
                     printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $image);
                 }
                 if (!empty($instance['show_gravatar'])) {
                     echo '<span class="' . esc_attr($instance['gravatar_alignment']) . '">';
                     echo get_avatar(get_the_author_meta('ID'), $instance['gravatar_size']);
                     echo '</span>';
                 }
                 if ($instance['show_title']) {
                     echo genesis_html5() ? '<header class="entry-header">' : '';
                 }
                 if (!empty($instance['show_title'])) {
                     if (genesis_html5()) {
                         printf('<h2 class="entry-title"><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     } else {
                         printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                     }
                 }
                 if (!empty($instance['show_byline']) && !empty($instance['post_info'])) {
                     printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info']));
                 }
                 if ($instance['show_title']) {
                     echo genesis_html5() ? '</header>' : '';
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if ('excerpt' == $instance['show_content']) {
                     the_excerpt();
                 } elseif ('content-limit' == $instance['show_content']) {
                     the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                 } else {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(esc_html($instance['more_text']));
                     $more = $orig_more;
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     echo '</div>';
     if ('full' !== $instance['columns']) {
         remove_filter('post_class', array($this, 'add_post_class_' . $instance['columns']));
     }
     //* Restore original query
     wp_reset_query();
     //* The EXTRA Posts (list)
     if (!empty($instance['extra_num'])) {
         if (!empty($instance['extra_title'])) {
             echo $before_title . esc_html($instance['extra_title']) . $after_title;
         }
         $offset = intval($instance['posts_num']) + intval($instance['posts_offset']);
         $query_args = array('post_type' => $instance['post_type'], 'showposts' => $instance['extra_num'], 'offset' => $offset);
         // Extract the custom tax term, if provided
         if ('any' != $instance['tax_term']) {
             list($post_tax, $post_term) = explode('/', $instance['tax_term'], 2);
             $query_args['tax_query'] = array(array('taxonomy' => $post_tax, 'field' => 'slug', 'terms' => $post_term));
         }
         $wp_query = new WP_Query($query_args);
         $listitems = '';
开发者ID:neilgee,项目名称:featured-custom-post-type-widget-for-genesis,代码行数:67,代码来源:class-featured-custom-post-type-widget-registrations.php

示例11: widget


//.........这里部分代码省略.........
                 $size_wh = $instance['image_size'];
                 // needed size (set in widget)
                 $custom_image = '<img width="' . absint($img_sizes[$size_wh]['width']) . '" height="' . absint($img_sizes[$size_wh]['height']) . '" src="' . esc_url($instance['image_url']) . '" class="attachment-' . $size_wh . $img_centered . '" alt="' . the_title_attribute('echo=0') . '" />';
                 printf('<%1$s %2$s title="%3$s" class="%4$s%5$s">%6$s</%1$s>', $instance['image_link'] ? 'a' : 'span', $instance['image_link'] ? 'href="' . esc_url(get_permalink()) . '"' : '', the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), $img_centered, $custom_image);
             }
             // end if
             /** Page title support */
             if (!empty($instance['page_title_show'])) {
                 if (!empty($instance['page_title_limit'])) {
                     $page_title = genesis_truncate_phrase(the_title_attribute('echo=0'), $instance['page_title_limit']) . $instance['page_title_cutoff'];
                 } else {
                     $page_title = get_the_title();
                 }
                 // end if
                 $page_link = sprintf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), $page_title);
                 /** Genesis 2.0+ / HTML5 way: */
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><h2 class="entry-title">%s</h2></header>', !$instance['page_title_link'] ? $page_title : $page_link);
                 } else {
                     printf('<h2>%s</h2>', !$instance['page_title_link'] ? $page_title : $page_link);
                 }
                 // end if
             }
             // end if
             /** Page Byline support */
             if (!empty($instance['byline_show']) && !empty($instance['page_post_info'])) {
                 printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['page_post_info']));
             }
             // end if
             /** Set optional "autark" custom 'More Link' */
             $more_link_target = 'none' != $instance['more_link_target'] ? ' target="' . esc_html($instance['more_link_target']) . '"' : '';
             $autark_more_link = sprintf('<div class="gfpe-more-link"><a class="more-link%s" href="%s"%s title="%s">%s</a></div>', !empty($instance['more_link_class']) ? ' ' . esc_attr($instance['more_link_class']) : '', empty($instance['more_link_url']) ? get_permalink($instance['page_id']) : esc_url($instance['more_link_url']), $more_link_target, esc_html($instance['more_link_text']), $instance['more_link_text']);
             /**
              * 1) Content Type: Original Page Content (optional with wpautop!)
              */
             if ('page_content' === $instance['content_type']) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 /** a) No content limit is set: */
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $more = 0;
                     printf('%s', $instance['page_keep_wpautop'] ? wpautop(the_content()) . $autark_more_link : get_the_content() . $autark_more_link);
                 } else {
                     printf('%s', empty($instance['more_link_url']) ? the_content_limit((int) $instance['content_limit'], esc_html($instance['more_link_text'])) : the_content_limit((int) $instance['content_limit'], '') . $autark_more_link);
                 }
                 // end if
                 echo genesis_html5() ? '</div>' : '';
             }
             // end if
             /**
              * 2) Content Type: Original Page Excerpt
              */
             if ('page_excerpt' === $instance['content_type']) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 printf(the_excerpt() . '%s', empty($instance['more_link_show']) ? '' : $autark_more_link);
                 echo genesis_html5() ? '</div>' : '';
             }
             // end if
             /**
              * 3) Content Type: Custom Text by user
              */
             if ('custom_user_content' === $instance['content_type']) {
                 echo '<div class="entry-content custom-content">';
                 $content = apply_filters('widget_text', empty($instance['custom_content']) ? '' : $instance['custom_content'], $instance);
                 echo $instance['custom_wpautop'] ? wpautop($content) : $content;
                 echo '</div>';
                 if (!empty($instance['more_link_text'])) {
                     echo $autark_more_link;
                 }
                 // end if
             }
             // end if
             /**
              * 4) Content Type: no content at all
              */
             if ('no_content' === $instance['content_type']) {
                 if ($instance['more_link_text']) {
                     echo $autark_more_link;
                 }
                 // end if
             }
             // end if
             /** Genesis markup: close */
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div><!--end post_class()-->' . "\n\n"));
         }
         // end while (when pages exist)
     }
     // end if loop check
     /** Display widget outro text if it exists */
     if (!empty($instance['outro_text'])) {
         printf('<div class="textwidget"><p class="%s-outro_text gfpe-outro-text">%s</p></div>', $this->id, $instance['outro_text']);
     }
     // end-if optional outro
     /** Action hook 'gfpe_after_search_widget' */
     do_action('gfpe_after_search_widget', $instance, $this->id_base);
     /** Output the closing widget wrapper */
     echo $after_widget;
     /** Reset our custom $wp_query object */
     wp_reset_query();
 }
开发者ID:BarkerCA,项目名称:parallax,代码行数:101,代码来源:gfpe-widget-featured-page-extras.php

示例12: omega_entry

/**
 * Display the default entry metadata.
 */
function omega_entry()
{
    if (is_home() || is_archive() || is_search()) {
        ?>
	
		<div <?php 
        omega_attr('entry-summary');
        ?>
>
	<?php 
        if (get_theme_mod('post_thumbnail', 1) && has_post_thumbnail()) {
            if (!class_exists('Get_The_Image')) {
                apply_filters('omega_featured_image', printf('<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), get_the_post_thumbnail(get_the_ID(), get_theme_mod('image_size'), array('class' => get_theme_mod('image_size')))));
            } else {
                get_the_image(array('size' => get_theme_mod('image_size')));
            }
        }
        if ('excerpts' === get_theme_mod('post_excerpt', 'excerpts')) {
            if (get_theme_mod('excerpt_chars_limit', 0)) {
                the_content_limit((int) get_theme_mod('excerpt_chars_limit'), get_theme_mod('more_text', '[Read more...]'));
            } else {
                the_excerpt();
            }
        } else {
            the_content(get_theme_mod('more_text'));
        }
        ?>
	
		</div>
	<?php 
    } else {
        ?>
	
		<div <?php 
        omega_attr('entry-content');
        ?>
>
	<?php 
        the_content();
        wp_link_pages(array('before' => '<p class="page-links">' . '<span class="before">' . __('Pages:', 'omega') . '</span>', 'after' => '</p>'));
        ?>
	
		</div>
	<?php 
    }
}
开发者ID:davidgilman,项目名称:Live2Give,代码行数:49,代码来源:hooks.php

示例13: widget

 /**
  * Echo the widget content.
  *
  * @since 0.1.8
  *
  * @global WP_Query $wp_query Query object.
  * @global integer  $more
  *
  * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
  * @param array $instance The settings for the particular instance of the widget
  */
 function widget($args, $instance)
 {
     global $wp_query;
     //* Merge with defaults
     $instance = wp_parse_args((array) $instance, $this->defaults);
     echo $args['before_widget'];
     //* Set up the author bio
     if (!empty($instance['title'])) {
         echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title'];
     }
     $wp_query = new WP_Query(array('page_id' => $instance['page_id']));
     if (have_posts()) {
         while (have_posts()) {
             the_post();
             genesis_markup(array('html5' => '<article %s>', 'xhtml' => sprintf('<div class="%s">', implode(' ', get_post_class())), 'context' => 'entry'));
             $image = genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'], 'context' => 'featured-page-widget', 'attr' => genesis_parse_attr('entry-image-widget', array('alt' => get_the_title()))));
             if ($instance['show_image'] && $image) {
                 $role = empty($instance['show_title']) ? '' : 'aria-hidden="true"';
                 printf('<a href="%s" class="%s" %s>%s</a>', get_permalink(), esc_attr($instance['image_alignment']), $role, $image);
             }
             if (!empty($instance['show_title'])) {
                 $title = get_the_title() ? get_the_title() : __('(no title)', 'genesis');
                 /**
                  * Filter the featured page widget title.
                  *
                  * @since  2.2.0
                  *
                  * @param string $title    Featured page title.
                  * @param array  $instance {
                  *     Widget settings for this instance.
                  *
                  *     @type string $title           Widget title.
                  *     @type int    $page_id         ID of the featured page.
                  *     @type bool   $show_image      True if featured image should be shown, false
                  *                                   otherwise.
                  *     @type string $image_alignment Image alignment: alignnone, alignleft,
                  *                                   aligncenter or alignright.
                  *     @type string $image_size      Name of the image size.
                  *     @type bool   $show_title      True if featured page title should be shown,
                  *                                   false otherwise.
                  *     @type bool   $show_content    True if featured page content should be shown,
                  *                                   false otherwise.
                  *     @type int    $content_limit   Amount of content to show, in characters.
                  *     @type int    $more_text       Text to use for More link.
                  * }
                  * @param array  $args     {
                  *     Widget display arguments.
                  *
                  *     @type string $before_widget Markup or content to display before the widget.
                  *     @type string $before_title  Markup or content to display before the widget title.
                  *     @type string $after_title   Markup or content to display after the widget title.
                  *     @type string $after_widget  Markup or content to display after the widget.
                  * }
                  */
                 $title = apply_filters('genesis_featured_page_title', $title, $instance, $args);
                 $heading = genesis_a11y('headings') ? 'h4' : 'h2';
                 if (genesis_html5()) {
                     printf('<header class="entry-header"><%s class="entry-title"><a href="%s">%s</a></%s></header>', $heading, get_permalink(), $title, $heading);
                 } else {
                     printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 }
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if (empty($instance['content_limit'])) {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(genesis_a11y_more_link($instance['more_text']));
                     $more = $orig_more;
                 } else {
                     the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text'])));
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     echo $args['after_widget'];
 }
开发者ID:Oak86,项目名称:matthewbuttler.work,代码行数:93,代码来源:featured-page-widget.php

示例14: widget

 /** Widget Output */
 function widget($args, $instance)
 {
     extract($args);
     // defaults
     $instance = wp_parse_args((array) $instance, array('title' => '', 'posts_cat_1' => '', 'posts_cat_2' => '', 'posts_cat_3' => '', 'posts_cat_4' => '', 'posts_cat_5' => '', 'posts_cat_6' => '', 'posts_cat_7' => '', 'posts_cat_8' => '', 'posts_cat_9' => '', 'posts_cat_10' => '', 'show_image' => 0, 'image_alignment' => '', 'image_size' => '', 'show_title' => 0, 'show_byline' => 0, 'post_info' => '[post_date] ' . __('By', 'genesis') . ' [post_author_posts_link] [post_comments]', 'show_content' => 'excerpt', 'content_limit' => '', 'more_text' => __('[Read More...]', 'genesis')));
     echo $before_widget;
     // Pull the chosen categories into an array
     $cats = array($instance['posts_cat_1'], $instance['posts_cat_2'], $instance['posts_cat_3'], $instance['posts_cat_4'], $instance['posts_cat_5'], $instance['posts_cat_6'], $instance['posts_cat_7'], $instance['posts_cat_8']);
     // Display the tab links
     echo '<ul class="ui-tabs-nav">';
     foreach ((array) $cats as $cat) {
         if ($cat) {
             echo '<li><a href="#cat-' . $cat . '">' . get_cat_name($cat) . '</a></li>';
         }
     }
     echo '</ul>';
     // Loop through all chosen categories
     foreach ((array) $cats as $cat) {
         if (!$cat) {
             continue;
         }
         // skip iteration if $cat is empty
         // Custom loop
         $tabbed_posts = new WP_Query(array('cat' => $cat, 'showposts' => 1, 'orderby' => 'date', 'order' => 'DESC'));
         if ($tabbed_posts->have_posts()) {
             while ($tabbed_posts->have_posts()) {
                 $tabbed_posts->the_post();
                 echo '<div id="cat-' . $cat . '" ';
                 post_class('ui-tabs-hide');
                 echo '>';
                 if (!empty($instance['show_image'])) {
                     printf('<a href="%s" title="%s" class="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), esc_attr($instance['image_alignment']), genesis_get_image(array('format' => 'html', 'size' => $instance['image_size'])));
                 }
                 if (!empty($instance['show_title'])) {
                     printf('<h2><a href="%s" title="%s">%s</a></h2>', get_permalink(), the_title_attribute('echo=0'), get_the_title());
                 }
                 if (!empty($instance['show_byline']) && !empty($instance['post_info'])) {
                     printf('<p class="byline post-info">%s</p>', do_shortcode(esc_html($instance['post_info'])));
                 }
                 if (!empty($instance['show_content'])) {
                     if ('excerpt' == $instance['show_content']) {
                         the_excerpt();
                     } elseif ('content-limit' == $instance['show_content']) {
                         the_content_limit((int) $instance['content_limit'], esc_html($instance['more_text']));
                     } else {
                         the_content(esc_html($instance['more_text']));
                     }
                 }
                 echo '</div><!--end post_class()-->' . "\n\n";
             }
         }
     }
     echo $after_widget;
     wp_reset_query();
 }
开发者ID:hscale,项目名称:webento,代码行数:56,代码来源:plugin.php

示例15: widget


//.........这里部分代码省略.........
                  *                                           descending order of posts.
                  *     @type bool   $exclude_displayed       True if posts shown in main output
                  *                                           should be excluded from this widget
                  *                                           output.
                  *     @type bool   $show_image              True if featured image should be
                  *                                           shown, false otherwise.
                  *     @type string $image_alignment         Image alignment: alignnone,
                  *                                           alignleft, aligncenter or alignright.
                  *     @type string $image_size              Name of the image size.
                  *     @type bool   $show_gravatar           True if author avatar should be
                  *                                           shown, false otherwise.
                  *     @type string $gravatar_alignment      Author avatar alignment: alignnone,
                  *                                           alignleft or aligncenter.
                  *     @type int    $gravatar_size           Dimension of the author avatar.
                  *     @type bool   $show_title              True if featured page title should
                  *                                           be shown, false otherwise.
                  *     @type bool   $show_byline             True if post info should be shown,
                  *                                           false otherwise.
                  *     @type string $post_info               Post info contents to show.
                  *     @type bool   $show_content            True if featured page content
                  *                                           should be shown, false otherwise.
                  *     @type int    $content_limit           Amount of content to show, in
                  *                                           characters.
                  *     @type int    $more_text               Text to use for More link.
                  *     @type int    $extra_num               Number of extra post titles to show.
                  *     @type string $extra_title             Heading for extra posts.
                  *     @type bool   $more_from_category      True if showing category archive
                  *                                           link, false otherwise.
                  *     @type string $more_from_category_text Category archive link text.
                  * }
                  * @param array  $args     {
                  *     Widget display arguments.
                  *
                  *     @type string $before_widget Markup or content to display before the widget.
                  *     @type string $before_title  Markup or content to display before the widget title.
                  *     @type string $after_title   Markup or content to display after the widget title.
                  *     @type string $after_widget  Markup or content to display after the widget.
                  * }
                  */
                 $title = apply_filters('genesis_featured_post_title', $title, $instance, $args);
                 $heading = genesis_a11y('headings') ? 'h4' : 'h2';
                 if (genesis_html5()) {
                     printf('<%s class="entry-title"><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 } else {
                     printf('<%s><a href="%s">%s</a></%s>', $heading, get_permalink(), $title, $heading);
                 }
             }
             if (!empty($instance['show_byline']) && !empty($instance['post_info'])) {
                 printf(genesis_html5() ? '<p class="entry-meta">%s</p>' : '<p class="byline post-info">%s</p>', do_shortcode($instance['post_info']));
             }
             if ($instance['show_title']) {
                 echo genesis_html5() ? '</header>' : '';
             }
             if (!empty($instance['show_content'])) {
                 echo genesis_html5() ? '<div class="entry-content">' : '';
                 if ('excerpt' == $instance['show_content']) {
                     the_excerpt();
                 } elseif ('content-limit' == $instance['show_content']) {
                     the_content_limit((int) $instance['content_limit'], genesis_a11y_more_link(esc_html($instance['more_text'])));
                 } else {
                     global $more;
                     $orig_more = $more;
                     $more = 0;
                     the_content(genesis_a11y_more_link(esc_html($instance['more_text'])));
                     $more = $orig_more;
                 }
                 echo genesis_html5() ? '</div>' : '';
             }
             genesis_markup(array('html5' => '</article>', 'xhtml' => '</div>'));
         }
     }
     //* Restore original query
     wp_reset_query();
     //* The EXTRA Posts (list)
     if (!empty($instance['extra_num'])) {
         if (!empty($instance['extra_title'])) {
             echo $args['before_title'] . esc_html($instance['extra_title']) . $args['after_title'];
         }
         $offset = intval($instance['posts_num']) + intval($instance['posts_offset']);
         $query_args = array('cat' => $instance['posts_cat'], 'showposts' => $instance['extra_num'], 'offset' => $offset);
         $wp_query = new WP_Query($query_args);
         $listitems = '';
         if (have_posts()) {
             while (have_posts()) {
                 the_post();
                 $_genesis_displayed_ids[] = get_the_ID();
                 $listitems .= sprintf('<li><a href="%s">%s</a></li>', get_permalink(), get_the_title());
             }
             if (mb_strlen($listitems) > 0) {
                 printf('<ul>%s</ul>', $listitems);
             }
         }
         //* Restore original query
         wp_reset_query();
     }
     if (!empty($instance['more_from_category']) && !empty($instance['posts_cat'])) {
         printf('<p class="more-from-category"><a href="%1$s" title="%2$s">%3$s</a></p>', esc_url(get_category_link($instance['posts_cat'])), esc_attr(get_cat_name($instance['posts_cat'])), esc_html($instance['more_from_category_text']));
     }
     echo $args['after_widget'];
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:101,代码来源:featured-post-widget.php


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