How to solve the unwanted "continue reading" link problem
-
Hi Micah,
First of all, fantastic work on this plugin. I just wanted to share my solution to the “Continue Reading” link issue in-plugin.
One of the other solutions offered was to “hide” the link in CSS, however this may mean an SEO hit due to masked links, so I wanted to provide a plugin-controlled way to remove the link altogether.
This is really to help people that don’t feel comfortable messing with code and function files etc (and because no matter how I tried to disable it myself in functions, no combination of overrides or action weights helped the issue (using a child theme derived from twentyeleven).
PLEASE NOTE: This solution will break if the plugin is updated… maybe this can be added to the next version?
My solution was to add a line into promotion-slider/includes/functions.php:
function promoslider_display_excerpt($values){ global $post; extract($values); $excerpt = preg_replace('/(<a .+?)+(<\/a>)/i', '', $excerpt); ... ...
Notice the addition of the preg_replace line to match the anchor tag, and remove it.
In a user friendly version of this, it would need to be wrapped into an admin option similar to $display_excerpt, where the user could elect to remove the “Continue Reading” link. Something like this in the function:
if($continue_reading == "hide") { $excerpt = preg_replace('/(<a .+?)+(<\/a>)/i', '', $excerpt);
Hope this helps!
- The topic ‘How to solve the unwanted "continue reading" link problem’ is closed to new replies.