function wm_content_or_excerpt($post, $content_filters = true) { //Helper variables $output = $link = ''; //Requirements check if (!$post || !is_object($post) || !isset($post->post_content) || !isset($post->ID)) { return; } //Preparing output if (false !== stripos($post->post_content, '<!--more-->')) { //Display excerpt until <!--more--> tag //Helper variables //Required for <!--more--> tag to work global $more; $more = 0; $output .= '<div class="more-tag-excerpt">'; if (!post_password_required()) { if (has_excerpt()) { $output .= wm_excerpt(); } $output .= $content_filters ? apply_filters('wmhook_content_filters', get_the_content('')) : get_the_content(''); } else { $output .= '<strong>' . __('Password protected', 'wm_domain') . '</strong>'; } $output .= '</div>'; $link = get_permalink() . '#more-' . $post->ID; } else { //Display excerpt only $output .= wm_excerpt(); $link = get_permalink(); } if ($output) { $output .= '<p class="more-link-container">'; $output .= wm_more(array('link' => $link)); $output .= '</p>'; } //Output return apply_filters('wmhook_wm_content_or_excerpt_output', $output); }
function wm_content_or_excerpt( $post ) { $out = ''; if ( isset( $post ) && $post ) { if ( false !== stripos( $post->post_content, '<!--more-->' ) ) { global $more; //required for <!--more--> tag to work $more = 0; //required for <!--more--> tag to work $out .= '<div class="excerpt">'; if ( has_excerpt() && ! post_password_required() ) $out .= '<div class="excerpt">' . apply_filters( 'wm_default_content_filters', get_the_excerpt() ) . '</div>'; $out .= ( ! post_password_required() ) ? ( apply_filters( 'wm_default_content_filters', get_the_content( '' ) ) ) : ( '<strong>' . __( 'Password protected', 'lespaul_domain' ) . '</strong>' ); $out .= '</div>'; $out .= '<p><a href="' . get_permalink() . '#more-' . $post->ID . '" class="more-link">' . __( 'Continue reading »', 'lespaul_domain' ) . '</a></p>'; } else { $out .= wm_excerpt( 'wm_excerpt_length_blog', 'wm_excerpt_more' ); $out .= '<p><a href="' . get_permalink() . '" class="more-link">' . __( 'Continue reading »', 'lespaul_domain' ) . '</a></p>'; } } return $out; }
*/ if (have_posts()) { wmhook_postslist_before(); echo '<div id="list-articles" class="list-articles list-search clearfix"' . wm_schema_org('item_list') . '>'; wmhook_postslist_top(); while (have_posts()) { the_post(); $output = '<article class="search-item"' . wm_schema_org('article') . '>'; $output .= '<header class="entry-header"><h1 class="entry-title"' . wm_schema_org('name') . '>'; if (has_post_thumbnail()) { $thumb_size = !function_exists('wma_amplifier') ? array(100, 100) : 'admin-thumbnail'; $output .= '<a href="' . get_permalink() . '" title="' . esc_attr(get_the_title()) . '">'; $output .= get_the_post_thumbnail(get_the_ID(), $thumb_size); $output .= '</a>'; } $output .= '<a href="' . get_permalink() . '">'; $output .= get_the_title(); $output .= '</a>'; $output .= '</h1></header>'; $output .= wm_excerpt(); $output .= 'page' === get_post_type() ? wm_post_meta(apply_filters('wmhook_search_page_meta', array('meta' => array('permalink')))) : wm_post_meta(); $output .= '</article>'; echo $output; } wmhook_postslist_bottom(); echo '</div>'; wmhook_postslist_after(); } else { wm_not_found(); } wp_reset_query();
echo wm_thumb(array('attr-link' => wm_schema_org('image'), 'link' => get_permalink(), 'size' => $image_size)); } ?> </div> <?php } /** * Post title */ wm_post_title(); /** * Post content */ if ($is_single) { //Outputs full post content including excerpt at the top wmhook_entry_top(); if (has_excerpt() && !$pagination_suffix && !wm_option('blog-disable-single-post-excerpt')) { echo wm_excerpt(); } //Content is stripped out fo media echo apply_filters('the_content', $content); wmhook_entry_bottom(); } else { //Outputs excerpt or content until <!--more--> tag echo $content; //filters already applied in wm_content_or_excerpt() } ?> </article>