how to use the_excerpt for two post queries?

function excerpt($limit) { $excerpt = explode(‘ ‘, get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(” “,$excerpt).’…’; } else { $excerpt = implode(” “,$excerpt); } $excerpt = preg_replace(‘`\[[^\]]*\]`’,”,$excerpt); return $excerpt; } write below code in your template. <?php echo excerpt(25); ?>

multiple excerpt length and styles

Are you aware of the uses of the More Tag? Customizing the Read More shows many uses of variable length teasers with variable link phrases to read more. For example, this markup entered in the Post editor will provide a link with Read the rest of this story in the anchor text. <!–more Read the … Read more

Can’t change excerpt length and more tag

excerpt_length filter does not work on manually added filter so you use wp_trim_excerpt function, you can develop code same as following to achieve it. <?php if( has_excerpt() ){ the_excerpt(); } else { wp_trim_excerpt(); } ?> excerpt_more does not work on WordPress version 2.8.x and Older for those versions you have to use following filter. <?php … Read more

Using tag to output text in Genesis?

You can hook in the banner using the the_content_more_link filter by modifying this code. add_filter( ‘the_content_more_link’, ‘sp_read_more_link’ ); function sp_read_more_link() { return ‘<a class=”your-banner” href=”‘ . get_permalink() . ‘”>[Banner Shortcode]</a>’; } Another option would be to create a shortcode for your banner, and add the shortcode to the the_content_more_link filter above. Or you could simply … Read more

Read More link scrolling page

There is an explanation in the WordPress Codex which I copy here for reference. Don’t forget <?php and ?> <?php function remove_more_link_scroll( $link ) { $link = preg_replace( ‘|#more-[0-9]+|’, ”, $link ); return $link; } add_filter( ‘the_content_more_link’, ‘remove_more_link_scroll’ ); ?> Prevent Page Scroll When Clicking the More Link

Read more link isn’t working with custom query

Finally found the answer for anyone else out there having the same problem. Turns out for custom queries like mine using WP_Query more link functionality is OFF by default. To turn it on… this worked for me. <?php global $more; $more = 0; the_content(‘Read More’); ?>

get “read more” with custom DB query like you would with WP Query

The <!– more –> tag isn’t applied via the the_content filter, it’s included in the get_the_content() function, which checks for the existence of the tag within the content using a regex and then outputs the more link appropriately. this output is filtered via the the_content_more_link filter, but since you’re not using get_the_content() you won’t be … Read more

need help with ‘… read more’ excerpt in functions.php

Took me a couple of blind tries, but I got it. Before: <a class=”view-article” href=”‘ . get_permalink($post->ID) . ‘”>’ . __(‘View Article’, ‘html5blank’) . ‘</a>’; After: <a data-toggle=”modal” data-target=”#modal-‘ . $post->ID . ‘ ” class=”over”>’ . __(‘View Article’, ‘html5blank’) . ‘</a>’