Member
Member
os07   2012-05-31, 22:47
#1
I've got a link to one of my theme's custom pages (called publications.php), which looks like this:

<a>">My linked page</a>

I want the link to go to that page, but to a specific named anchor, say, <a>some text</a>

I think I need to write a custom function to do this, but could use some ideas on how to handle the syntax.

TIA for your help!
Administrator
Administrator
fretzl   2012-06-01, 04:34
#2
You can use the [i]menu_manager[/i] plugin to create a custom menu item.
Member
Member
os07   2012-06-01, 15:15
#3
Well, I really need to place this link in the middle of a block of text, so I don't think that the custom menu item is the right solution?
Administrator
Administrator
acrylian   2012-06-01, 15:57
#4
I fear I don't understand the actual problem...
Member
Member
os07   2012-06-01, 16:04
#5
Perhaps I have not described the issue clearly.

I want to put a link on some text that appears of my custom pages. This link goes to another custom page - I know how to do that. But I want the link to go to a specific named anchor on that linked page.

This is the link as it now appears, just linking to the second custom page:

`You can see our publications by clicking here`

But I want the link to go to a named anchor on the 'publications' page. The specific anchor is expressed in the ordinary way:

`<a name="volumes">Some text here</a>`

So, I need to figure out how to modify the getCustomPageURL function so that it allows me to insert the correct anchor name.
Administrator
Administrator
acrylian   2012-06-01, 16:18
#6
Ah, ok. `<a href="<?php echo getCustomPageURL('publications'); ?>#anchor">` should work fine as the function just returns `http://yourdomain.com/page/<pagename>`.

Btw, the function has also a parameter for query additions (which an anchor basically is).
Member
Member
os07   2012-06-01, 19:38
#7
I tried appending the anchor that way, but it doesn't seem to add anything to the link to the page itself.
Administrator
Administrator
acrylian   2012-06-01, 19:52
#8
I don't understand. If you add it it is added to the link. Here a link within the theming tutorial as the news page is technically just a special custom page:
http://www.zenphoto.org/news/theming-tutorial#part-2
Member
Member
os07   2012-06-04, 14:33
#9
Works fine, now - a cache problem, I think.

Thanks again for your help!
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.