dsf23223 2009-07-30 20:21
浏览 137
已采纳

在另一个页面内获取Wordpress导航

I'd like to only get the worddpress navigation (header, navigation menu, footer) so I can add custom pages to the site which can easily integrate in the general template of the side while showing other things in the center instead of blog postings?

Edit: To clarify, I'd either like to know if there's an easy way to include the functions like header(), footer() (or whatever they're called) of Wordpress in another page, so where those functions are called, it echoes the general layout of Wordpress.

Or, I'd like to know which html files I can include to display the wordpress template's header, footer, and navagiation menu on a page.

What I'm trying to do is build my own pages on a website, outside of wordpress, which will use my own framework and php code, but call the wordpress's template to make the look & feel of the pages integrate with the rest of the site.

  • 写回答

3条回答 默认 最新

  • dongrouli2667 2009-07-30 20:41
    关注

    Add the following lines of code, then you can use whatever WP function you want:

    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    

    Example from my own site:

    <?php 
    define('WP_USE_THEMES', false);
    require('./wordpress/wp-blog-header.php');
    get_header();
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题