dougang1605 2013-03-16 10:09
浏览 81

在非wordpress网站上显示wordpress页脚

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:support@TXTimpact.com">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>
  • 写回答

2条回答 默认 最新

  • douchong8393 2013-03-16 10:34
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据