How to make a button?

There is plenty of information on how to make the Read More function display different text in the Codex but what kind of filter would need to be used to make it display <button class="readmorebtn" onclick(permalink)>Read More</button>?

2 Answers
2

The “(more…)” link gets filtered through the_content_more_link in get_the_content(). You can hook into this function and let it return whatever you want.

add_filter('the_content_more_link', 'more_button');
function more_button($more_link) {
    return '<button class="readmorebtn" onclick="' .
        esc_attr('window.location="' . get_permalink() . '"') .
        '">Read more</button>';
}

Leave a Comment