• I followed TechGnome’s tutorial for making static pages in WordPress.
    I’ve separated my menu div into a file called staticmenu.php which is called into my index.php in the appropriate place via ‘<‘?php include_once(‘staticmenu.php’); ?’>’ and also into my static pages in the same way (all reside in the same root directory). I realize the menu links work because they are ‘relative’ links to my WP directory.
    I would like to be able to call that same file into other php pages that DO NOT reside in the WP directory but rather in other subfolders. The idea being that edit changes to ‘staticmenu.php’ would transcend my entire site. Right now I am ‘viewing source’ from the rendered page, copying the rendered menu div into a second “re_menu.php” in a common includes subfolder which is being called into any pages in subfolders.
    I’m trying to simplify having to edit 2 menu.php’s Can I edit staticmenu.php in some way, so the links work whether called to a page in the WP directory or to another subdirectory outside the WP directory? Or is my present approach what I am constrained to?
    Thanks.
    Kevin

Viewing 7 replies - 1 through 7 (of 7 total)
  • You could make your include relative to your root too….
    See if this helps:

    <?php
    include_once ($abspath."/menu.php");
    ?>

    TG

    If wp-blog-header.php was included, that should have worked. And as I sit here looking over my menu.php file, I realize what else works.:

    <?php include_once("/menu.php");?>

    By starting it off with / it will start at the root. So in the above case, my menu.php is in the root folder. It could just as easily be:

    <?php include_once("/wp/menu.php");?>

    If it was in a folder called WP.
    TG

    Thread Starter phpneophyte

    (@phpneophyte)

    TechGnome,
    I was trying to have the menu div included in another program (miniBB). Here’s paul’s answer;
    Hi Kevin,
    …you are including this file from another script which ALREADY contains necessary variables (and
    another directory is not the reason here). For example, the script you are including from contains variables $siteurl, and functions like get_archives(), bloginfo() etc. Of course, miniBB does not contain all
    these functions and variables. In order this header to work, you’ll need also to include these functions in miniBB, and all variables too.
    Paul

    Gonna have to rethink my methodology a little ??
    Kevin

    Just out of curiosity, is wp-blog-header.php being included?
    TG

    Thread Starter phpneophyte

    (@phpneophyte)

    Just out of curiosity, is wp-blog-header.php being included? In my menu div? No. Or are you suggesting I add that to the miniBB engine? I don’t know how but I will have to see if I can. I think miniBB has an equivalent of a my-hacks.php file;
    you can include in bb_specials.php (for example) – you only need to associate all menu content with some variable, and then put this variable usual way in a template. (from miniBB support forum)
    I haven’t quite figured outwhat “then put this variable usual way in a template” is yet. And I don’t have a clue as to how to associate all menu content with some variable
    I appreciate you taking time to explore this a little TechGnome, and I’m a litle surprised you did as I know NOTHING about php so can’t contribute any possible solutions I am afraid to say. I just thought maybe someone had already melded WP and miniBB in some way so would offer how they did it.
    I noticed on the miniBB forum there are occassional inquiries as how to fit WP and miniBB together probably because that is the forum being used here. For myself, I like the simplicity of BOTH programs for the uninitiated user. Now wouldn’t it be great if down the road WP included a simple forum feature too? ??
    Anyway, if you want to pursue this, I’ll be glad to be the guinea pig (if I can get it anybody can). However I’m not expecting you to, and again I appreciate your responses.
    Kevin

    No problem…. I know very little of miniBB (maybe I should install it at home one of these days). It doesn’t surprise me that there are a lot of such requests, since miniBB is what they use here. BUT I do know they did A LOT of hacking to it to get it like this.
    I haven’t quite figured outwhat “then put this variable usual way in a template” is yet. And I don’t have a clue as to how to associate all menu content with some variable – yeah, I’m not sure what that’s all about either.
    The quickest answer I can think of is this:
    At the top of menu.php, put this:
    <?php require_once('wp-blog-header.php'); ?>
    This will include the wp-blog-header.php file if it hasn’t already been included. So, when usingthe blog, it’ll already be included and skip over it. But when commign from the BB, it’ll see that it isn’t included yet, and include it.
    TG

    Thread Starter phpneophyte

    (@phpneophyte)

    I’ll diddle with it and let ya know. Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting “Menu links” to work in subdirectories?’ is closed to new replies.