the value of the target patameter must be all lowercase and any spaces must be replaced with a dash. This can be achieved by applying the sanitize_title_with_dashes() function to the profile name:
try replacing
the_field('profile_name')
with
sanitize_title_with_dashes( the_field( 'profile_name' ) )
Hi,
thanks again for the attention. Didn’t seem to work for me. The field is a persons full name so will always have initial caps and a space so I’d need to combine sanitize functions to use title with dashes and also make it all lowercase if that’s possible do you know?
i tried removing the uppercase characters in the field to just test the title_with_dashes but I get the same result I was having bfore.
<a href="<?php echo get_site_url(); ?>/meet-us/?target=<?php sanitize_title_with_dashes( the_field( 'profile_name' ) ) ?>" class="btn"> Read more →</a>
Just as a test though, I just edited a profile name to one word all lowercase with no spaces and the target thing still doesn’t work. I get this in the url bar and the page just loads as normal with no tab open.
http://www.domain.com/meet-us/?target=thename
I have mine set to always be set on accordion with my breakpoint being 5000px if that makes any difference?
The target parameter works on my test site when the viewport width puts it into accordion mode, so that shouldn’t be the issue.
I think your test didn’t work as the target value need any spaces replaced with dashes (inaddition to removing any punctuation and converting to lowercase) Removing the space without adding in a dash will not work
Assuming the tab title you want to target is ‘The Name’, Try this as a test instead:
http://www.domain.com/meet-us/?target=the-name
Hi cubecolour,
where I said I just edited a profile name to one word all lowercase with no spaces and the target thing still doesn’t work I meant I actually changed the profile name in the CPT editor so that the_field( 'profile_name' ) was now just a single name like ‘joe’ for example.
http://www.domain.com/meet-us/?target=joe
where the link is:
<a href="<?php echo get_site_url(); ?>/meet-us/?target=<?php the_field('profile_name') ?>" class="btn"> Read more →</a>
And the code for the tab is:
<?php echo do_shortcode('[tabby title=" '. get_field('profile_name') .' "]');?>
Just loads the page with this in the url and the tab closed. So the target thing still doesn’t work for me even when I do this.
So I think even before looking at trying to get the sanitisation to work for removing uppercase and replacing spaces with dashes I seem to have a problem. Does the above code I have all look right assuming I’m just using a single name with no uppercase for now?
Thanks again!
What happens when you put the url with the target parameter in the browser address bar?
eg
http://www.domain.com/meet-us/?target=the-name
Once you have that working then you can look at how to build the URL in the code.
If that URL doesn’t do what we expect it to, that issue needs to be investigated before looking at how to output it.
please provide a link to the page on your site where you are testing this.
Hi again,
yeah it doesn’t work, I had already tried doing that. The page is in dev so is password protected. Could I please send you this password privately?
If I need to log onto the site, that would be beyond the scope of the free support I can provide.
OK, do you offer paid support?
In addition to the free public support available here, private support for my plugins is available via http://cubecolour.co.uk/premium-support/
Ok great thanks, I’ll do that then..