Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example function for how to add a custom wrapper to a WordPress `more` tag.
<?php
/**
* Creates a custom 'Read More' link by prepending and appending columns on either
* side of the anchor to create a divider between the next post.
*
* @param string $link The anchor for rendering the more tag
* @return string $link The text for the more tag
* @package mayer
* @since 1.0.0
*/
function example_add_more_link_class( $link, $text ) {
$html = '<div class="more-link-wrapper">';
$html .= '<div class="divide col-md-5"></div>';
$html .= '<div class="col-md-2">' . $link . '</div>';
$html .= '<div class="divide col-md-5"></div>';
$html .= '</div>';
return $html;
} // end example_add_more_link_class
add_action( 'the_content_more_link', 'example_add_more_link_class', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.