Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejcabquina/6608addd50d25ada0c61211e9b98087d to your computer and use it in GitHub Desktop.
Save ejcabquina/6608addd50d25ada0c61211e9b98087d to your computer and use it in GitHub Desktop.
generate_content_more_link_output
add_filter('generate_excerpt_more_output', function(){
$custom_text = get_field('read_more_text');
return sprintf( ' ... <a title="%1$s" class="read-more" href="%2$s" aria-label="%4$s">%3$s</a>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) ),
$custom_text,
sprintf(/* translators: Aria-label describing the read more button */
_x( 'More on %s', 'more on post title', 'generatepress' ),
the_title_attribute( 'echo=0' ))
);
});
add_filter('generate_content_more_link_output', function(){
$custom_text = get_field('read_more_text');
return sprintf(
'<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" aria-label="%4$s">%3$s</a></p>',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump', '#more-' . get_the_ID() ) ),
$custom_text,
sprintf(
/* translators: Aria-label describing the read more button */
_x( 'More on %s', 'more on post title', 'generatepress' ),
the_title_attribute( 'echo=0' )
)
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment