Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have some <!--more--> tags in my posts and they work...to a degree. Instead of doing a hard break after the <!--more--> tag, it continues on to show some of the next paragraph of text followed by a ...

How can I get the <!--more--> tag to be a hard break?

Thanks

example on homepage

share|improve this question
    
You need to show use how your theme is handling this code-wise. –  Wyck Jan 30 '13 at 18:50
    
I'm still a wordpress noob, I need to know which code specifically you need to see. Some keywords I can search for? –  Brian Jan 30 '13 at 19:03
    
    
this seems to be the meat & potatos of the function but I dont know what to modify. maybe you can suggest? $maxchar=(strpos($content, '<!--more-->'))?strpos(preg_replace('/<.*?>/', '', preg_replace('/<!--more-->/','@smt_readmore_tag',$content)), '@smt_readmore_tag'):$maxchar; –  Brian Jan 30 '13 at 19:18
add comment

1 Answer

The more-Tag have a filter, you can enhance this with a small plugin like the follow example.

<?php
/**
 * Plugin Name: br after more-Tag
 * Description: Add content of var $extra_more after more-Tag
 * Version:     0.0.1
 */

! defined( 'ABSPATH' ) and exit;

add_filter( 'the_content_more_link', 'custom_more_link', 9999 );
function custom_more_link( $more_link ) {

    $extra_more = '<br>'; // here add your break

    return $more_link . $extra_more;
}

If you will replace the more tag with your markup, then use a small plugin and preg_replace.

add_filter( 'the_content', 'fb_more_link' );
function fb_more_link( $content ) {

    // only on single posts
    if ( ! is_single() )
        return $content;

    // adsense code
    $my_content = '<br>';

    // replace more tag
    $content = preg_replace('/<span id\=\"(more\-\d+)"><\/span>/', $my_content, $content);
    return $content;
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.