0

According to this page in the codex, https://codex.wordpress.org/Customizing_the_Read_More, I just need to add a certain function to the functions.php file to get it to work. I'm doing so in a child theme so updates to the main theme don't erase this coding. The problem is that every time I try, the functions.php stops working altogether. I'm not sure what I'm doing wrong or if there's something I'm missing.

This is the way the child looks before adding the code:

<?php
function my_theme_enqueue_styles() {

$parent_style = 'frontier-style';

wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
    get_stylesheet_directory_uri() . '/style.css',
    array( $parent_style ),
    wp_get_theme()->get('Version')
);
?>

Here's how it looks when I add the relevant code to the file.

<?php
function my_theme_enqueue_styles() {

$parent_style = 'frontier-style';

wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
    get_stylesheet_directory_uri() . '/style.css',
    array( $parent_style ),
    wp_get_theme()->get('Version')
);
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function modify_read_more_link() {
return '<a class="Read More" href="' . get_permalink() . '">There's still more to read. Click Here!</a>';
}
add_filter( 'the_content_more_link', 'modify_read_more_link' );
?>

I copied and pasted that direction from the link I provided, so I'm not sure why it isn't working. I've also tried adding it as a separate php function and that doesn't work either.

2
  • 1
    One thing that's sticking out to me is that in modify_read_more_link() the apostrophe in there's needs to be escaped: return '<a class="Read More" href="' . get_permalink() . '">There\'s still more to read. Click Here!</a>'; Commented Jun 9, 2017 at 18:51
  • 1
    That's it. Amazing how something so simple can stare you right in the face and you overlook it. That was indeed the problem. Thanks.
    – OscarGuy
    Commented Jun 9, 2017 at 19:09

1 Answer 1

0

As Dave Romsey pointed out in his comment, the answer was simple: a stray apostrophe. Issue resolved.

1
  • Woohoo! Glad that did the trick. Please revisit your answer in a couple of days and click the checkmark to accept it. This will close the question out. Thank you! Commented Jun 9, 2017 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.