The MU forums have moved to WordPress.org

Help with Custom Include Statement (6 posts)

  1. mattloak
    Member
    Posted 14 years ago #

    I'm running several sites off of one template with with custom logos and a few custom options and I'd like to keep using just one template so when I make changes to the structure I only update once and it updates all the sites. The only problem I'm having is I'd like to be able to call different elements into the template for different sites with php includes that call a specific value from my admin panel but can't get the include statement to work.

    Basically I have a custom function that names the style of the site. To call this I would normally call:

    <?php echo get_option('custom_style'); ?>

    The "custom style" is the name of the directory that custom site specific files are in. How would I call this in my php include statement to it would inject the value between the temlplate path and the php file name?

    I'd like this...

    <?php include (TEMPLATEPATH . '/custom_header.php'); ?>

    to somehow do this...

    <?php include (TEMPLATEPATH . '/[insert my custom function here]netheader.php'); ?>

    I know this isn't really a wordpress issue, more of an issue with my php knowledge but I'd really appreciate any help.

    Thanks!
    Matt

  2. DeannaS
    Member
    Posted 14 years ago #

    There's a whole bunch of custom css plugins out there. Maybe one of those would do what you're looking for?

  3. andrea_r
    Moderator
    Posted 14 years ago #

    For what you want to do use one of the custom css plugins.

    http://wpmututorials.com/plugins/css-editor-plugins/

  4. mattloak
    Member
    Posted 14 years ago #

    I appreciate the feedback but that is not at all what I'm looking for. This has nothing to do with CSS. Don't let the word "style" in my function throw you, this really has nothing to do with style, I just named my function that for internal purposes.

    CLARIFICATION:

    I want to write a php include statement that will call a custom function that I have set in my wordpress admin. For example, if I wanted to just call and echo the custom value that I set I would use the statement:

    <?php echo get_option('custom_value'); ?>

    and it would display the word I typed into that field in the back end. This is not a problem I have this working fine, but I can't figure out how to get this custom value inserted into a "include statement"

    I'd like this...

    <?php include (TEMPLATEPATH . '/custom_header.php'); ?>

    to somehow do this...

    <?php include (TEMPLATEPATH . '/[insert my custom function value here]netheader.php'); ?>

    That way my template has one php include statement calling the header or any file I choose, and depending on which site it is and the settings I choose in my admin it will call a different file. This will allow me to show a couple different template files depending on which site I'm on but still allow all the sites to use just one theme.

    How do I insert this value dynamically into an include statement?

  5. DeannaS
    Member
    Posted 14 years ago #

    I haven't tried it, but can't you just do:

    <?php include (TEMPLATEPATH . customfunction() . 'netheader.php'); ?>
  6. mattloak
    Member
    Posted 14 years ago #

    DeannaS, I forgot to say thank you. That was exactly what I was looking for.

About this Topic

  • Started 14 years ago by mattloak
  • Latest reply from mattloak