Viewing 15 replies - 16 through 30 (of 31 total)
  • Thread Starter stephanie_2

    (@stephanie_2)

    ok, thank you! and sorry for messing around. i’m really desperat cause it seems like some weeks now since i’m trying to get this together…
    anyway, what code exactly do you mean?

    Thread Starter stephanie_2

    (@stephanie_2)

    here is the header php:
    link to pastepin
    looks very complicated to me..

    That’s one very busy header, lots of stuff going on..

    That said, it appears this function grabs the nav menu.

    hbb_get_nav()

    Which can be seen near the top of the header.

    Can you have a look in functions.php and see if you can find that function, you’re basically looking for a line that starts like this..

    function hbb_get_nav() {

    If you can find that function would you please copy the complete code from the file the function is in, again into a pastebin, then i’ll take a look at writing a modification to it for you.

    Not making any promises that i can modify the menu for you (i’ve not seen the menu code yet), but i’ll give it a shot if you can track down where the menu code is.. (hopefully the functions file).

    NOTE: When i mention the functions.php file, i refer to the one in wp-content/themes/YOUR_THEME/.

    Thread Starter stephanie_2

    (@stephanie_2)

    thats very nice, thank you!
    here is the hbb_get_nav function out of the function.php of the theme:
    pastepin

    Ok, should be simple hopefully.

    Backup your code first please.

    This line will need to be changed.

    $nav.='<a href="'.$wpurl."/".get_page_uri($child->ID).'">'.$child->post_title.'</a>';

    To something like.

    $nav .= '<a href="' . $wpurl . '/'.str_replace(' ', '-', $pagg->post_title ) . '#' . $child->post_title . '">' . $child->post_title . '</a>';

    Which will replace the sub-item links with links to the parent page, with the child page title as the anchor name.

    If something isn’t quite right, or needs adjustment, just post back.. ??

    Thread Starter stephanie_2

    (@stephanie_2)

    thank you! i made it, nothing changed visibly
    where and how can i now indicate the command – the one you mentioned in your first reply – to the submenu-items?

    Visually it should look the same, that was the intention wasn’t it? Just to update the submenu links to point at parent page anchors, which it should now do..

    Can you confirm?

    Thread Starter stephanie_2

    (@stephanie_2)

    ok, but where do i have to put the anchor jump commands?
    when i do it above the subpage edit field in the permalink editor, it removes automatically the # sign…?

    You don’t have to do anything, just swap the code as mentioned above.

    The menu links are generated by the menu function, not by something you do from the admin area.

    This was the original line that generated the submenu links.

    $nav.='<a href="'.$wpurl."/".get_page_uri($child->ID).'">'.$child->post_title.'</a>';

    Which should now be.

    $nav .= '<a href="' . $wpurl . '/'.str_replace(' ', '-', $pagg->post_title ) . '#' . $child->post_title . '">' . $child->post_title . '</a>';

    Which adds the anchor for you automatically.

    If i’m misunderstanding something, please clarify (you’re still using the original menu right?).

    Thread Starter stephanie_2

    (@stephanie_2)

    i see! so the anchor names are nothing more than the subpage titles!
    …have to check this

    Thread Starter stephanie_2

    (@stephanie_2)

    hm, doesn’t work yet. i would think there is still another command on click, which tries to load something…, some loading gif comes up

    because the subpage funktion – originally at this theme – is made with ajax…

    i checked the functions.php again, should be fine as you told (link)

    here is the site where i made some anchors (exactly as the sub-items) for the “komposition” content
    https://wolfgangboehmer.com/#komposition

    thank you for your patience!

    Thread Starter stephanie_2

    (@stephanie_2)

    maybe it’s some minor string thing…
    because when i click film (sub-item), this shows up in the browser url:
    https://wolfgangboehmer.com/#komposition/film
    and not, how it should be:
    https://wolfgangboehmer.com/#komposition/#film
    ?
    but when i put it up by hand it doesn’t work either…

    https://img153.imageshack.us/img153/2368/clipboard1u.jpg (Screenshot)

    In my browser at least, the submenu items do link as i suggested they would.

    What did you change by hand?

    As far as i can see the links do what you asked for them to do.

    Thread Starter stephanie_2

    (@stephanie_2)

    you’re right, down there it shows the right link, but doesn’t scroll up the page…? strange is that at my firefox it shows the right link only when i rollover, after i clicked it makes something and than it says “finished”. hm, thats probabely a different problem and i feel pretty bad to bother you again and again. i would be very very happy when this would finally work and i could offer you help in design stuff – whats my profession – or just pay for it…
    but anyway thank you very much!:)

    Do the anchors exist? You only asked for help making the submenu items into anchor links, you’ll still need to ensure the actual anchors exist on the page.

    I’m not familiar with your theme, so you’ll have to dig and figure out how to add anchors yourself, the hard part is done though(the php stuff).. ??

    Let me know if you get stuck.

    Anchor info.
    https://www.w3schools.com/TAGS/tag_a.asp
    https://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_link_bookmark

Viewing 15 replies - 16 through 30 (of 31 total)
  • The topic ‘sub-menu-item ->jump to page anchor’ is closed to new replies.