One page navigation
-
Hello. This is my first post here so forgive me if something’s wrong (like category etc.)
So I have a one page template and everything works – if I click a link it just goes to a desired section on a page. Links are just made by adding
#go-to-this-section
(and of course some jQuery to prevent default behavior of link and add some scrolling).Now I’ve added a blog and it is an “external” link – it just goes to blog page. When I’m there I can’t go back to the first page. How can I make this work? I thought I could add some conditios like if it is on blog then it would add a full url to the one page before the
#go-to-this-section
but how do I do that?
-
Can you provide a URL please, or explain the question more clearly? Are you using some plugin to accomplish what you’re trying to accomplish?
When you say external link, it appears you’re suggesting that it doesn’t open up a new browser or tab; it just takes users off that 1 page you’d like to keep ’em on.
Assuming I’m understanding this correctly, you just need to set your homepage so that it’s set to all your posts.
To accomplish this, it can probably be done in your theme’s settings. You can also go to your wp-admin, Appearances >> Reading >> Front place displays >> set it to your latest posts.
Or just have a menu that allows the user to go back to the home page. Again, I’m not sure at all if I’m understanding your question, but if you provided a URL and a bit more clarity, perhaps I can help.
Well I don’t have it live (developing it on localhost) but I’m working with this HTML template – https://demos.rafalborowski.com/ebookie/
Now The WP version is just the same but it also has a Blog. Now the main page is set just as you said and it is set to this one page. Now when I click on blog it takes me there an everything works except I cannot go back to this first paga.
See this page – https://demo.drythemes.com/dry-wp-one-page/. I’m trying to accomplish exactly the same thing here. When you click on links it’s scrolling to different parts, but when you click on the last link – shortcodes – it takes you to other page (in my example this would be the blog). Then when you click on other links (while still on shortcodes) it takes you back to exact section you clicked.
PS. Not using any 3rd party plugins.
First of all, this is a paid theme. They should have a support staff!
Secondly, it’s an odd theme; kind of cool, different, but odd. So I’d have to look at the source code and check things out.
Thirdly, I don’t see the blog link, so I’m unsure as to how that’s functioning, so it’s difficult to address that question.
Most importantly, in the sample you provided, the menu is not sticking to the top. There’s some css class for that theme’s menu — main-menu is-sticky. So somewhere in your theme options, I’d bet there’s an option to make your theme’s menu sticky, so it sticks to the top. Find it in your wp-admin theme options. I bet it’s just a tick box you have to check somewhere. Something like “Make menu sticky” in your theme’s options.
If there’s not an option for this, then a scroll-to-top plugin would be necessary. I use Jquery Smooth Scroll, although there are several of these. But this shouldn’t be necessary.
First of all I know it’s a paid theme (both of them are paid) – ebookie is my own theme the second one is not mine. There is no blog since as I wrote before it’s HTML theme that now I’m trying to code into WP.
Secondly why are you telling me how to make the menu sticky? I was not asking about that.
Let me explain that again. Lets take https://demo.drythemes.com/dry-wp-one-page/#np-855 as an example.
1. Go there
2. Click “SERVICES”
3. the URL ishttps://demo.drythemes.com/dry-wp-one-page/#np-855
4. Click ‘SHORTCODES’
5. the URL is nowhttps://demo.drythemes.com/dry-wp-one-page/shortcode/
6. click ‘SERVICES’
7.URL ishttps://demo.drythemes.com/dry-wp-one-page/#np-855
and here becomes the problem. If I do this it’s fine until point 5. It’s the same in my theme (theme I just shown above is example, it’s not my theme and I don’t care about it).
1. When I click something it goes to
https://www.sitename.com/#some-link
2. When I click blog it goes tohttps://www.sitename.com/blog/
3. Now when on blog I click some other page it goes tohttps://www.sitename.com//blog/#some-link
and this is not what I want. I want it to go back tohttps://www.sitename.com/#some-link
Okay … I’m kinda gettin’ the hang of it. This theme is made by guys who are very skilled with css … not too skilled with SEO, but you can fix that. Smart, though, that they put some of their external javascript files before the closing </body> tag, so they know a little about SEO.
Unless you make me a temporary admin login and PW so I can see what’s goin’ on, a lot of this is just conjecture, but I’m getting a clearer picture of things.
Now, are your menu items posts or pages? And what’s the difference between your blog menu item than the others? There’s some type of difference. If I had admin access I could figure it out right away.
It may have to do with your permalink structure (settings >> permalinks), but I really need to know more about how your site operates.
But just now, I Firebugged that demo’s /shortcode/ menu item, and it has slightly different css classes than the other menu items. It seems /shortcode/ is a separate page, and the other menu links are like … I don’t know without looking into your site’s structure.
Are those menu links pages or posts? We have to start from there.
Ok Sir thank you for your precious time, but we are not getting anywhere here. Can someone please just answser this question:
If I go to Apperance >> Menus and set a Custom link URL to :
#this-is-an-anchor-link
then how to make it display on page (in the code) not as an:
<a href="#this-is-an-anchor-link">Link</a>
but as a full link/path like this:
<a href="https://somesite.com/#this-is-an-anchor-link">Link</a>
.Please note that permalinks are set to Post name and that this page where the links are is set to be the Home page.
then how to make it display on page (in the code) not as an Link but as a full link/path
Can you give an example of you would like the full link/path to look like?
Can you give an example of you would like the full link/path to look like?
<a href="https://somesite.com/#this-is-an-anchor-link">Link</a>
Go to Appearance >> Menus >> Custom Links
Then just put your own custom link you would like in there for each and every menu item.
Add each custom link as a menu item until your navbar menu is populated as you please.
That will serve as your top navbar menu.
This;
<a href="#this-is-an-anchor-link">Link</a>
Will turn into this;
https://somesite.com/#this-is-an-anchor-link
It’s only if you specify a forward slash at the start of the URL that it turn into this;
#this-is-an-anchor-link
Then just put your own custom link you would like in there for each and every menu item.
Heh…. yes… I know that would work. But it’s not the solution I am searching for Sir. I need a function etc. that will put the full blog URL before the anchor tag by itself so no matter on what server this would be it would still work.
that will put the full blog URL before the anchor tag by itself so no matter on what server this would be it would still work.
The hash tag will append to the URL, so just use
#this-is-an-anchor-link
.It’s only if you specify a forward slash at the start of the URL
I’ve tried this and it kinda works. The problem is when I have a wordpress instalation in a folder for example:
https://localhost/wordpress/
then by inputing forward shash at the beginning like this:
/#this-is-an-anchor-link
it takes me to:
https://localhost/#this-is-an-anchor-link
and of course I would like to go to:
https://localhost/wordpress/#this-is-an-anchor-link
What if you remove the forward slash and just have the hash tag and preceding text?
Well then it jumps to the specified part of the page as expected when i’m on this page. But then if I go to blog (which is different page) then of course it stops working since on blog there are no references to those anchors on blog. And I cannot get back to the previous page since the link isn’t a full URL but just an anchor.
- The topic ‘One page navigation’ is closed to new replies.