Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i put an external link #1

Closed
Akrosid opened this issue Sep 25, 2013 · 4 comments
Closed

How can i put an external link #1

Akrosid opened this issue Sep 25, 2013 · 4 comments

Comments

@Akrosid
Copy link

Akrosid commented Sep 25, 2013

all is working, but when i put an external link it's doesn't work.
How can i do for that?

@ChrisWojcik
Copy link
Owner

That feature isn't available, I've been meaning to add it in. I won't be able to work on this for a few days, but if you want to add it in yourself before I can, I'm sure conditional logic in the plugin would do the trick.

Here are a few ideas on how to target external links only:
http://css-tricks.com/snippets/jquery/target-only-external-links/

@ChrisWojcik
Copy link
Owner

Update: this is now available.

To achieve this, add a class onto the links you want to filter out, for example class="external".

Use the new 'filter' option to filter out these links. ( i.e. ':not(.external)' )

See the demo for a clearer example:
http://chriswojcik.net/demos/single-page-nav/

Let me know if you run into any problems!

@pankajk1018
Copy link

Hello chris
I am working on a WordPress theme and used your plugin to navigate withing page. I was having same problem and found this filter. But in WordPress nav how can we add aclass dynamically to only that link which have external href value as http://.... Can you please help.
Thank you

@ChrisWojcik
Copy link
Owner

If I understand what you're asking, it sounds like more of a WP development question. I don't develop WP themes regularly, so I'll try to help the best I can.

I did find this article after a quick google search, can't promise it's 100% up to date, but sounds like what you might want on the WP back-end:
http://sevenspark.com/how-to/how-to-add-a-custom-class-to-a-wordpress-menu-item

If this is for a theme that will be distributed, I'm not sure if you can rely on the user to add the correct class.

Another option might be to target all links which are external in your navigation with javascript and then add a class to them.

Some jquery approaches for trying to target external links in this way:
http://css-tricks.com/snippets/jquery/target-only-external-links/

Like I said, I'm not a wordpress theme developer, so if these don't suit your needs, I'm not sure if there are other WP plugins or options out there that might fit your situation better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants