Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jose Luis SAYAGO

    (@iluminatus)

    Hello Roman,

    The only solution I can come with right now is to use jQuery to strip trailing slashes (check this example: Strip Trailing Slashes), I will show you how to do it:

    1.- Create a JavaScript file named untrail-nlplinks.js & save it into your theme’s root folder (where style.css is found)

    Copy & paste the code below:

    <script type="text/javascript">
         // Once the document is ready
         jQuery(document).ready(function(){
             // Check links under NLPosts Wrapper
             jQuery('.nlposts-wrapper').each(function(e){
                 // Get the content
                 var str = jQuery(this).html();
                 // Look for .html/
                 var regex = /(.html\/)/ig
                 // Replace trailing slash for .html links
                 var replaced_text = str.replace(regex, ".html");
                 // Return link
                 jQuery(this).html(replaced_text);
             });
          });
    </script>

    2.- Then add this to your functions.php:

    wp_enqueue_script('untrail-links',get_stylesheet_directory_uri().'/untrail-nlplinks.js');

    Please let me know if this works for you.

    Cheers.

    Thread Starter Roman

    (@lrv)

    Hello Jose,

    Thanks for your help.
    Unfortunately it didn’t help. Nothing has changed.

    Regards.

    Plugin Author Jose Luis SAYAGO

    (@iluminatus)

    Hi Roman,

    Just wondering, did you clear your browser cache before testing? Sometimes JavaScript files are not loaded right after doing these changes, it takes a minute or so to display changes.

    To be sure, inspect your site’s code using your browser developer tools (in chrome you can use the Developer Tools) and make sure untrail-nlplinks.js is being correctly included in your header or footer.

    Looking forward to your feedback.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Added slash (/) at the end of each link’ is closed to new replies.