mileman41 Posted October 17, 2015 Share Posted October 17, 2015 Hello all, I've tried for a few hours to scour the web for the answer, but I'm very elementary with php so feel like I am missing something very simple. I have two web sites that are hosted together (arkcos.com and arkcities.com) arkcos.com is the primary domain with an arkicities folder inside the root arkcos.com folder I am trying to get the top bar that is on my wordpress header at arkcities.com to go on top of my web site at arkcos.com/nsp (this is a subdomain nsp.arkcities.com) I've inserted the following code at the top of my main index.php file: <?php include '../../../../wp-content/themes/bayside/header.php'; ?> I've tried multiple iterations with the "../" - but the file structure is that the /nsp and /arkcities folders are both in the root directory, and the index file that I'm inserting the code into is four folders deep in the /nsp directory The error I get at th etop of my page on arkcos.com/nsp is: Warning: include(../../../../arkcities/wp-content/themes/bayside/header.php) [function.include]: failed to open stream: No such file or directory in /home/content/n/h/i/nhirsch/html/nsp/wp-content/themes/Presswork/presswork/index.php on line 1 Warning: include() [function.include]: Failed opening '../../../../arkcities/wp-content/themes/bayside/header.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/n/h/i/nhirsch/html/nsp/wp-content/themes/Presswork/presswork/index.php on line 1 Any help would be greatly appreciated. I apologize in advance if this is super easy and I'm just making a stupid mistake. Quote Link to comment https://forums.phpfreaks.com/topic/298656-using-include-to-point-to-correct-location/ Share on other sites More sharing options...
QuickOldCar Posted October 17, 2015 Share Posted October 17, 2015 (edited) Use the document root /home/content/n/h/i/nhirsch/html/nsp/wp-content/themes/bayside/header.php Edited October 17, 2015 by QuickOldCar Quote Link to comment https://forums.phpfreaks.com/topic/298656-using-include-to-point-to-correct-location/#findComment-1523537 Share on other sites More sharing options...
mileman41 Posted October 17, 2015 Author Share Posted October 17, 2015 (edited) Thanks! That makes perfect sense. The only issue now is that it tells me there is an error on line 18 in my header file with the get_option(). Is there anything else I would need to add to the include code to make it work, or is there something in my header file that won't allow it to be used on other sites? Below is my header file: <?php /** * The Header for our theme. * * @package progression * @since progression 1.0 */ ?><!doctype html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]--> <head> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width"> <?php if(is_front_page() && of_get_option('home_title')): ?> <title><?php echo of_get_option('home_title'); ?></title> <?php else: ?> <title><?php global $page, $paged; wp_title( '|', true, 'right' ); bloginfo( 'name' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description"; // Add a page number if necessary: if ( $paged >= 2 || $page >= 2 ) echo ' | ' . sprintf( __( 'Page %s', 'progression' ), max( $paged, $page ) ); ?></title> <?php endif; ?> <?php if(is_front_page() && of_get_option('home_meta')): ?> <meta name="description" content="<?php echo of_get_option('home_meta'); ?>" /> <?php endif; ?> <?php if(of_get_option('favicon')): ?><link href="<?php echo of_get_option('favicon'); ?>" rel="shortcut icon" /> <?php endif; ?> <link rel="profile" href="http://gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <?php if(of_get_option('page_fixed_header', '0')): ?><div id="sticky-navigation-spacer"></div><?php endif; ?> <header<?php if(of_get_option('page_fixed_header', '0')): ?> id="sticky-navigation-bayside"<?php endif; ?>> <div class="header-top"> <div class="grid2column"> <?php wp_nav_menu( array('theme_location' => 'header', 'depth' => 1, 'menu_class' => 'header-menu') ); ?> </div> <div class="grid2column lastcolumn"> <div class="social-icons"> <?php if(of_get_option('rss_link')): ?> <a class="rss" href="<?php echo of_get_option('rss_link'); ?>" target="_blank">r</a> <?php endif; ?> <?php if(of_get_option('facebook_link')): ?> <a class="facebook" href="<?php echo of_get_option('facebook_link'); ?>" target="_blank">F</a> <?php endif; ?> <?php if(of_get_option('twitter_link')): ?> <a class="twitter" href="<?php echo of_get_option('twitter_link'); ?>" target="_blank">t</a> <?php endif; ?> <?php if(of_get_option('skype_link')): ?> <a class="skype" href="<?php echo of_get_option('skype_link'); ?>" target="_blank">s</a> <?php endif; ?> <?php if(of_get_option('vimeo_link')): ?> <a class="vimeo" href="<?php echo of_get_option('vimeo_link'); ?>" target="_blank">v</a> <?php endif; ?> <?php if(of_get_option('linkedin_link')): ?> <a class="linkedin" href="<?php echo of_get_option('linkedin_link'); ?>" target="_blank">l</a> <?php endif; ?> <?php if(of_get_option('dribbble_link')): ?> <a class="dribbble" href="<?php echo of_get_option('dribbble_link'); ?>" target="_blank">d</a> <?php endif; ?> <?php if(of_get_option('forrst_link')): ?> <a class="forrst" href="<?php echo of_get_option('forrst_link'); ?>" target="_blank">f</a> <?php endif; ?> <?php if(of_get_option('flickr_link')): ?> <a class="flickr" href="<?php echo of_get_option('flickr_link'); ?>" target="_blank">n</a> <?php endif; ?> <?php if(of_get_option('google_link')): ?> <a class="google" href="<?php echo of_get_option('google_link'); ?>" target="_blank">g</a> <?php endif; ?> <?php if(of_get_option('youtube_link')): ?> <a class="youtube" href="<?php echo of_get_option('youtube_link'); ?>" target="_blank">y</a> <?php endif; ?> </div><!-- close .social-icons --> </div> <div class="clearfix"></div> </div><!-- close .header-top--> <h1 id="logo"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo of_get_option('logo', get_template_directory_uri() . '/images/logo.png'); ?>" alt="<?php bloginfo('name'); ?>" width="<?php echo of_get_option('logo_width'); ?>" /></a></h1> <nav> <?php wp_nav_menu( array('theme_location' => 'primary', 'depth' => 4, 'menu_class' => 'sf-menu') ); ?> </nav> <div class="clearfix"></div> </header> <div id="main" class="site-main"> Edited October 17, 2015 by Ch0cu3r Added code tags Quote Link to comment https://forums.phpfreaks.com/topic/298656-using-include-to-point-to-correct-location/#findComment-1523568 Share on other sites More sharing options...
QuickOldCar Posted October 17, 2015 Share Posted October 17, 2015 Most likely need this plugin for the subdomain https://wordpress.org/plugins/options-framework/ You can enable multisites in wordpress and it would share all same files. Is no need to install multiple instances of wordpress. http://codex.wordpress.org/Create_A_Network In the root directory edit wp-config.php define( 'WP_ALLOW_MULTISITE', true ); Quote Link to comment https://forums.phpfreaks.com/topic/298656-using-include-to-point-to-correct-location/#findComment-1523575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.