• Hello, this is my first post so please bear with me.

    I am editing the code (shown below) in the wp-includes/post-template.php file to add target=”_blank” so that the link will open to a new window but I keep getting syntax error.

    $output .= apply_filters( 'the_content_more_link', ' <a href="' . get_permalink( $_post ) . "#more-{$_post->ID}\" class=\"more-link\">$more_link_text</a>", $more_link_text );

    Could you please tell me where should I insert the target=”_blank” ?

    Thanks in advanced.

    Victor

    • This topic was modified 6 years, 6 months ago by vvillarin.
    • This topic was modified 6 years, 6 months ago by vvillarin.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi vvillarin,

    Please try below code may be it can help you-

    $output .= apply_filters( 'the_content_more_link', '<a href="' . get_permalink( $_post ) . '#more-{$_post->ID}" target="_blank" class="more-link">$more_link_text</a>', $more_link_text )

    • This reply was modified 6 years, 6 months ago by baranwal.
    • This reply was modified 6 years, 6 months ago by baranwal.
    • This reply was modified 6 years, 6 months ago by baranwal.
    Thread Starter vvillarin

    (@vvillarin)

    Thanks for your time Barawal, I really appreciate your effeort to look into the code.
    I just added ; at the end of the code because it is showing syntax error without it then saved it with no issue.

    Unfortunately, the link is still not opening as a new window. 🙁

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Insert target=”_blank”’ is closed to new replies.