sorry this isn’t css related, but if anyone can help that would be great.
The content on some of my pages will be split into sections such as;
…and so on.
I would like the sidebar to contain links to these sections, anchored links to be precise. I can visualise how it’s going to work, but I’ve never really delved into php, only edited it here and there.
So does anyone know how I can achieve this? This needs to be something generic of course so that it would work on any page.
Actually while typing I’ve realised something, not all the content may have those precise headings, some may not have an introduction for example, so is there any way for the sidebar to pull these section headings from the page dynamically when it loads and generate a list of links based on the headings present?
thanks for all the replys!
Lol, doesn’t sound promising!
Yep, that’s what I’m after.
Here’s a diagramatic representation of what I mean (attachments aren’t uploading on the forum for some reason):
So essentially I want the sidebar to be able to pull the content headings from within the content and display them as a list, but also link to those headings. They’re normally called anchored links and are fairly straightforward, but integrating this into the sidebar is a little tricky.
If all the content was uniform it wouldn’t be a problem. However, the content that the site is going to display will not follow one template, so the headings are bound to be different.
I hope that explains it!
Instead of having recent content showing – these are individual posts, I’d like the sidebar to link to different paragraphs in one post only.
If for instance I write a post about 3000 words long and it’s divided by subheadings like introduction, background, conclusion etc. I want the sidebar to be able to pick those subheadings from within that one post and display them as links. With so many words it becomes more convenient to be able to directly skip/jump to a specific part of the post rather than scrolling up and down.
Is there any way I could define or class these headings so that they can be recognised and listed in the sidebar?
Cool thanks for the advice. I can totally see how that will work, if everything else fails that’s what I’ll have to do. I’ve been looking at the documentation and wordpress call this ‘page jump‘.
I’m going to try and delve into php over the next few weeks and see if I can get it to work. Here’s what I see in my head:
Step 1. Locate/Find instance of <a name= within the html code. e.g. <a name=”unique-identifier”>Introduction</a>
Step 2. Copy text within "" e.g. <a name=”unique-identifier”> and add to: <a href=”#add UI”>add UI</a> (Because the UI also = the subheading so can use it for both).
Step 3. Repeat for all instances of <a name= within the html code.
I just hope that particular instance isn’t used elsewhere in my pages or else I’m going to have a funny looking contents list.
So anyway, that’s what I’m going to work around. I’m going to have to start from scratch because I don’t even know the php function to locate a word! Let alone add to the list…
I’ll use google and the php site of course, but if anyone uses php and knows the functions that I should use please post here! Unfortunately this is only the beginning, I need to do add a few extra features to the sidebar, again specific to each post.
You must be logged in to reply to this topic.