Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1092734

    Hello
    Using ‘Legal News’ as an example (see private link), I have posts that once seen on a single page show the breadcrumb –

    Home / Legal News / Post Title

    The problem is that if I click on the ‘Legal News’ link it takes me to –
    /category/legal-news/

    Instead of –
    /legal-news/

    I’m not sure if that’s complicated to fix? I want to have the user go back to a page with other design elements instead of dynamically generating the list of posts in that category. Thank you in advance :)

    #1093129

    Hey webWahine,
    I believe there is a new option that is for this, I tried to test the files but they seem dependent on another change.
    In the meantime you could try this function. Try adding this code to the end of your functions.php file in Appearance > Editor:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(window).load(function(){
        $('#top.post-template-default.single #main .breadcrumb-trail > span:nth-child(4) a').each(function() {
        $(this).attr('href','http://new.com/legal-news/');
        $(this).on('click',function(){
       window.open(this.href);
          return false;
        });
        });
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Please correct your link in the code.

    Best regards,
    Mike

    #1093150

    Thanks, Mike

    I had to change the URL to –

    http://new.mineslaw.com

    It’s working but opening in a new window, even though I see you have ‘this’ in the window.open line. Please advise and thanks again :)

    #1093162

    Hi,
    Please try this:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(window).load(function(){
        $('#top.post-template-default.single #main .breadcrumb-trail > span:nth-child(4) a').each(function() {
        $(this).on('click',function(){
       window.open('http://new.mineslaw.com','_self')
          return false;
        });
        });
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Best regards,
    Mike

    #1093164

    Sorry, that linked to
    /category/legal-news/
    instead of
    /legal-news/
    I have the error 404 on and it’s just redirecting to home.

    #1093196

    Hi,
    I tried to edit your functions.php to adjust the code, but the Themes > Editor was not availability. Please enable, the option may be in your security plugin.

    Best regards,
    Mike

    #1093206

    Sorry, I added it into my functions.php in my child theme. I’ve put the FTP in the private area :)

    #1093211

    Hi,
    Thank you for the login, I change the script to this:

    function custom_script(){
      ?>
      <script>
    (function($){
      $(window).load(function(){
      $("#top.post-template-default.single #main .breadcrumb-trail > span:nth-child(4)").find("a").attr("href", "http://new.com");
      });
      })(jQuery);
    </script>
    <?php
    }
    add_action('wp_footer', 'custom_script');

    Please clear your browser cache and check.

    Best regards,
    Mike

    #1093376

    Sorry, that just takes me to the home page – I had to edit the URL – the first example worked perfectly except for the fact that it opened in a new window.

    #1093456

    Hi,
    That’s odd, I took another look and added it back in and made a video of what I get.
    Please watch the video and see if you get the same results.

    Best regards,
    Mike

    #1093702

    Thank you!!!!! Yes, it’s working now – I grabbed the latest functions.php from my child theme :)

    #1093770

    Hi,
    Glad we were able to help, we will close this now. Thank you for using Enfold.

    For your information, you can take a look at Enfold documentation here
    For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)

    Best regards,
    Mike

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Change breadcrumb link on single post pages’ is closed to new replies.