• I wanted to created a dynamic menu which was easily administered and updatable. Previously I had a simple php script which parsed an array and displayed it in a list. However I couldn’t update the file dynamically and had to edit the file any time I wanted to change it.
    I am not too adept at programming- but the results can be seen at my site: http://www.adailyadventure.com
    The menu at the top looks like your standard horizontal menu- However it is generated through a modified get_links function which accesses an alternate table from the link manager. Menu items can be managed from the Admin panel so you can change the link any time you want without needing to upload or edit any files.
    The source is at: http://www.adailyadventure.com/journal/dynamicmenu.zip
    Comments and assistance in improvement are greatly appreciated

Viewing 12 replies - 1 through 12 (of 12 total)
  • I’ll give this a try this weekend. Looks like it may be just the kind of thing I’m looking for.
    Thanks!

    Thread Starter clay

    (@clay)

    Cool, if you have any problems with the instructions let me know- I am still in shock I got it to work for me so I have no idea how it will go for someone else.
    It can certainly use some work I am sure- but I am at the end of my knowledge

    Thread Starter clay

    (@clay)

    Has anyone installed this?
    Does it work?
    Is it worth it?
    Any improvements?

    Thread Starter clay

    (@clay)

    I know some people have downloaded…

    Clay – I’ve downloaded and in the process of installing it now… so far no issues except that one of the instructions says to “Open or create my-hacks.php and add:
    <?php require_once(‘wp-includes/navlinks.php’); ?>”
    Okay… is it saying I need to create a new php file called “my-hacks.php”, include the line and then upload it to…??? my home directory? my wp-admin directory?
    That step has kind of lost me.

    Thread Starter clay

    (@clay)

    Sorry about the confusion-
    If you upgraded from a version prior to 1.2 you may have a my-hacks.php file in the root wordpress directory already.
    1.2 does not come with that file by default (it was replaced by the plugin function). So if it does not exist in the root directory of your blog, just create it. The only line it should include is the one in the instructions.
    In the admin panel, under Options> Miscellaneous make sure the ‘Use legacy my-hacks.php file support’ box is checked.
    Sorry if my explanations are not so clear- I don’t really know what I am doing!

    Thread Starter clay

    (@clay)

    sdollen: did you ever get it to work?

    Clay –
    I couldn’t get it to work. I followed all of the steps up to and including Step 5. I added the info in my index.php file and then when I clicked update, I received the following error.
    Warning: Cannot modify header information – headers already sent by (output started at /home/stefan/public_html/my-hacks.php:42) in /home/stefan/public_html/wp-admin/templates.php on line 74
    Here is the code that error is referring to:
    $newcontent = stripslashes($_POST[‘newcontent’]);
    $file = $_POST[‘file’];
    $file = validate_file($file);
    $real_file = ‘../’ . $file;
    if (is_writeable($real_file)) {
    $f = fopen($real_file, ‘w+’);
    fwrite($f, $newcontent);
    fclose($f);
    header(“Location: templates.php?file=$file&a=te”); <<— Line 74
    } else {
    header(“Location: templates.php?file=$file”);
    }
    Not sure if it had anything to do with having code already in the my-hacks.php file?

    sdollen – check your my-hacks.php file. if you have multiple php sections – startingwith <?php and ending with ?> – make sure there is NO WHITESPACE between the closing ?> and the next opening <?php tag…. it should look just like this:
    ?><?php … right next to each other. Also, after the final closing ?>, there should be no whitespace there either, not carriage return or space, nothing. This is the problem for that error 99.99999% of hte time.
    And, if you find that you do have ?><?php in there, you can actualy take that out, and leave it as one large php block of code (preferable this way actualy.)
    TG

    Thanks TG, that did solve the problem. I completed the install and it did create the menu for me – but, I’m wondering what the difference between using the added Menu-nav and the Links options are? I can do the same thing already using the Links tab on the admin page.
    I’m a pretty green newb – but, the navigation menu worked fine.

    Thread Starter clay

    (@clay)

    Sdollen: glad you got it to work.
    The differences between this added ‘navigation menu’ and the links menu:
    1. It only displays 1 category
    2. It grabs the category from a seperate table as the other links
    This allows you to dynamically create a navigation menu for your site, with links that do not appear in your regular links page.
    If you look at my site, that is all done using wordpress. I have taken the LINKS out of the side menu and placed them in their own page- which is linked on the MENU up top. That menu uses the plugin(hack) you just installed.
    Do you have a link to your site I would like to see how you implemented it

    found a plugin of interest w/r/t dynamic menu’s includes highlighting, multiple levels.. or not….
    http://www.adsworth.info/wp-pagesnav

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Dynamic Navigation Menu’ is closed to new replies.