• Resolved odyodyodys

    (@odyodyodys)


    Hi all,

    I am having a weird behavior.
    I styled the read-more tag like this:
    <?php the_content('<div class="post-readmore">Continue</div>'); ?>

    This works fine using the default text, but if I change the
    <!--more--> with something different per post such as <!--more Start Game -->. I am having the text “Start Game” in an anchor <a> but not wrapped in the <div>

    Here is the html
    with <!--more-->

    <a href="http://localhost/xxx/#more-2993" class="more-link">
    <div class="post-readmore">Continue</div>
    <p></a></p>

    with <!--more Start Game-->
    <p> <a href="http://localhost/xxx/#more-3050" class="more-link">Start Game</a></p>

    Also, notice the closing anchor in the first html, is inside a <p>. I don’t know about this either.
    My theme is base on monochrome and can be seen here odysonline.gr

Viewing 1 replies (of 1 total)
  • Thread Starter odyodyodys

    (@odyodyodys)

    Solution:
    Leave everything as TEXT only.
    Do Not follow that rule if you want to wrap the text.

    Do this instead:
    Add the following to your functions.php or even better, create a little plugin and do the following

    function wrap_readmore($more_link)
    {
    	return '<div class="post-readmore">'.$more_link.'</div>';
    }
    add_filter('the_content_more_link', 'wrap_readmore', 10, 1);

    This will wrap not only the default “more” text, but also the custom added as <!--more Start Game-->

Viewing 1 replies (of 1 total)
  • The topic ‘Custom read-more text wrapped in a div’ is closed to new replies.