-
-
Save tommcfarlin/acb0984795fc4ee569e2 to your computer and use it in GitHub Desktop.
An example function for how to add a custom wrapper to a WordPress `more` tag.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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