Jump to content
Sign in to follow this  
jessesoininen

Using post title as an anchor in the WP MAIN MENU

Recommended Posts

jessesoininen

Hi, What is the right way to point to an post page anchor from the WP MAIN MENU? Thank you in advance Jesse

Share this post


Link to post
Share on other sites
Kate

Hi Jesse, You can use a custom menu (Appearance->Menus). From there, it gives you the option to make a custom link. Simply add the text you want, and copy/paste the link of your post into the box.

Share this post


Link to post
Share on other sites
jessesoininen

This allmost works: http://www.domain.com/sitename/?p=626/ahref=#123_123/ Menu works and it opens the requested post. Now the problem is that i dont want to see a single post page but rahter the post container page with all the posts. (and the right anchor location: ahref=#123_123) Tried to call the the container Page but something went wrong.

Share this post


Link to post
Share on other sites
cmunns

You mean you want it to call the main posts page instead of a single post page? Wouldn't you just not use the ?p=id and use the url to the main blog instead? Also the final portion doesn't need the ahref=...it just needs a hashtag with a number e.g. `#123`

Share this post


Link to post
Share on other sites
timlinson
Anchor already in place in post.
Can you explain what you meant by this? If you already have anchors in place, you'd just use the anchor name after the hash.

Share this post


Link to post
Share on other sites
jessesoininen

I guess it could help if i can make my self understood:) 1. I do have a long post page with lots of posts in it. 2. Each individual post starting with headline and anchor. 3. Need to link these anchors to the main mennu so the user jumps from headline to another. 4. Now when trying to link the anchor and menu i??m only getting the empty post container page with no posts showing in it. 5. Looking for run down from start to finnish:) Thanks a lot for your patience and guidance

Share this post


Link to post
Share on other sites
jessesoininen

Please, my problem is this: 1. Long post page with lots of posts in it. 2. Each individual post starting with headline and anchor that i??ve alredy added. 3. Need to link these anchors to the main mennu so the user jumps from headline to another. 4. Now THE PROBLEM is that when i??m clicking the menu i??m only getting empty post container page with no posts showing in it OR either im getting single post depending on what URL i??m using in the custom menu. 5. I guess this all boils down on how to phrase the right custom URL address in menu editor.

Share this post


Link to post
Share on other sites
Kate

Hi Jesse, I'm not sure if you looked at the article I linked to, but I still believe that's what you're trying to accomplish. Look carefully at the code, and you'll see what modifications would need to be made in the PHP code.

Share this post


Link to post
Share on other sites
jessesoininen

As far as i can see the page you are suggesting is about HTML and not about PHP. ("Linking within the page and go to top html code") Anyway tried the method from the suggested page with no success. Suggested example is about linking within same page. I??m NOT looking this answer. I need to link from the main menu to the individual post headlines. I??m shure i am not the only one looking for this answer.

Share this post


Link to post
Share on other sites
cmunns

Jesse, Can you send us a link so we can see where you're at? Post Title are generated dynamically so adding hashtags is probably not something you can do using the native WordPress editor with modifying something. There is a definite disconnect here in what we understand and what you're trying to do because WordPress isn't meant to do this, but a link will help us troubleshoot your progress at any rate.

Share this post


Link to post
Share on other sites
jessesoininen

Thanks for your patience! I made a test set up site for this problem. http://www.buzz.fi/test/ In the Main menu bar there is only one item that points to the anchor in the last post. Post name: ???Menu item should point here!??? Link in the Main menu editor looks like this: http://www.buzz.fi/test/?p=623/ahref=#last/ Link works but it brings up an individual post. What i want is to stay in the same page view with all of the posts showing.

Share this post


Link to post
Share on other sites
cmunns

Right...so its only going to be able to stay on the same page if you use this format http://www.buzz.fi/test/#last ...the minute you have this http://www.buzz.fi/test/?p=623/#last/ it's going to point to an anchor on that specific page. I think the best way to tackle this is probably to use jquery or something like that to modify the URLs but first, did you try adding a simple anchor inside of the excerpt of that post to see if that would suffice?

Share this post


Link to post
Share on other sites
jessesoininen

HUGE thanks for you support! Menu works just fine now. I??will share my gratitude in Twitter & Facebook for you guys. One minor question: After adding custom links in the menu editor the menu button background colour turns from white to light grey. Do i need to add something to URL in order to keep the colour as it was?

Share this post


Link to post
Share on other sites
Kate

Hi Jesse, Double check the classes on the menu items, and compare them with the CSS declarations to see why they may not be being applied. Are you using Firebug? It would probably help you out.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×