Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created December 2, 2013 13:26
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tommcfarlin/acb0984795fc4ee569e2 to your computer and use it in GitHub Desktop.
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.
<?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