Reputation: 10506
I wanted to ask a quick question. I have two websites running on the same domain. The homepage is in complete HTML and it can be accessed by going to http://xyz.com/home while as for the inner pages, I have installed wordpress on the same domain and the pages can be accessed by going to http://xyz.com/sample-page. Now I have created a footer in wordpress and it's appearing correctly on the inner pages which is running wordpress but i want to show that very same footer on my HTML page too which isn't running wordpress. To do this, I added the following code to the index.php file of my homepage:
<footer>
<?php include '../wp-content/themes/metro/footer.php'; ?>
</footer>
Doing so is now showing me this error on the homepage:
Fatal error: Call to undefined function get_option() in /homepages/12/d378078258/htdocs/txtimpact-main/wp-content/themes/metro/footer.php on line 1
Can anybody please let me know that how can I modify the footer.php file so that the footer starts to appear on my homepage. I read a tutorial on the internet where the guy told to add this piece of code to the footer.php file but it didn't help in my case:
require( '../my_wordpress_install_root/wp-load.php' );
This is the code why my footer.php file contains:
<?php $options = get_option('metro'); ?>
</div><!--#page-->
</div><!--.container-->
</div>
<footer>
<div class="container">
<div class="footer-widgets">
<?php widgetized_footer(); ?>
<img style="position:absolute; visibility:show; left: -6px; top: 84px; } " src="http://cms.360ivr.com/wp-content/themes/metro/images/callout-bubble.png" width="22px" />
</div><!--.footer-widgets-->
</div><!--.container-->
<h12><?php mts_copyrights_credit(); ?></h12>
<div style="float: left; margin-top: 20px; margin-left: 153px;"><font size="2px">Copyright © 2006-12 TXTImpact - All Rights Reserved.<br/>Message and Data Rates may apply.<br/>To unsubscribe, text 'STOP' to 27126 or <a href="mailto:[email protected]">Contact Support</a>.<br/><a href="http://www.wire2air.com/" target="_blank">Powered by Wire2Air</a><br/><a href="http://nytm.org/made/" target="_blank">Proudly Made In NYC</a></font></div>
<div style="margin-right: 83px; margin-top: 91px;"><img src="http://cms.360ivr.com/wp-content/uploads/2013/03/mma1.png" width="450px" align="right" /></div>
</footer><!--footer-->
<?php mts_footer(); ?>
<?php wp_footer(); ?>
</body>
</html>
Upvotes: 2
Views: 683
Reputation: 26065
Supposing that the following file, http://example.com/connect-wp.php
is located at the same level as WordPress root files (http://example.com/
):
<?php
define( 'WP_USE_THEMES', false );
require( './wp-load.php' );
// Optional, maybe necessary for logged in users
// add_filter( 'show_admin_bar', '__return_false' );
include get_stylesheet_directory() . '/footer.php';
Of course, what comes before footer.php
in your custom file must match the HTML structure that the footer will create.
References:
Upvotes: 0
Reputation: 86
Your homepage http://xyz.com/home can't use WordPress functions (if you want them you have to include them manually). I advise you to use WordPress in showing homepage. WordPress have setting to show specific page as homepage.
Quote from the WordPress codex:
What Template is Used to Display a Particular Page? WordPress looks for several Page template files in your active WordPress Theme based upon the Template Hierarchy. The first one it finds will be used to display any given Page. WordPress will look for files in the following order:
The Page's selected "Page Template"
page.php
index.php
The WordPress Template Hierarchy also recognizes specific Pages or Posts automatically without the need to assign them to a specific Page template file. If the Page with ID or slug in the template file name is created by the user, the appropriate Page template file is automatically used.
page-{id}.php
page-{slug}.php
If the Page ID number is 42, the page-42.php
template file is automatically used. If the Page slug is "About", the page-about.php
template file is used.
Upvotes: 1