-
AuthorPosts
-
April 19, 2019 at 7:53 pm #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 :)
April 21, 2019 at 8:10 pm #1093129Hey 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,
MikeApril 21, 2019 at 10:02 pm #1093150Thanks, Mike
I had to change the URL to –
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 :)
April 21, 2019 at 11:50 pm #1093162Hi,
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,
MikeApril 22, 2019 at 12:06 am #1093164Sorry, that linked to
/category/legal-news/
instead of
/legal-news/
I have the error 404 on and it’s just redirecting to home.April 22, 2019 at 2:17 am #1093196Hi,
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,
MikeApril 22, 2019 at 2:30 am #1093206Sorry, I added it into my functions.php in my child theme. I’ve put the FTP in the private area :)
April 22, 2019 at 2:56 am #1093211Hi,
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,
MikeApril 22, 2019 at 5:52 pm #1093376Sorry, 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.
April 23, 2019 at 1:47 am #1093456Hi,
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,
MikeApril 23, 2019 at 5:05 pm #1093702Thank you!!!!! Yes, it’s working now – I grabbed the latest functions.php from my child theme :)
April 23, 2019 at 11:33 pm #1093770Hi,
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 -
AuthorPosts
- The topic ‘Change breadcrumb link on single post pages’ is closed to new replies.