doulubashang6936 2017-02-22 06:33
浏览 87

Wordpress菜单到另一个页面

I have wordpress installed on my server and I have another script in the server but another directory. How can I add the wordpress menu to my script page?

  • 写回答

1条回答 默认 最新

  • duanhui4160 2017-02-22 06:57
    关注

    You can do it using Simple HTML DOM you would do something like the following:

    <?php    
        $html = str_get_html("YOUR WORDPRESS SITE URL");
        $elem = $html->find('div[id=wrapper_content]', 0);//wrapper_content is you wordpress menu id    
        //right
        $file_contents = curl_exec($ch); //get the page contents
        preg_match($s_searchFor, $file_contents, $matches); //match the element
        $file_contents = $matches[0]; //set the file_contents var to the matched elements
    ?>
    

    Put this code were you have created menu for your script. This will get your wordpress menu in $file_contents variable and echo $file_contents; where your menu should be.

    评论

报告相同问题?

悬赏问题

  • ¥15 nslt的可用模型,或者其他可以进行推理的现有模型
  • ¥15 arduino上连sim900a实现连接mqtt服务器
  • ¥15 vncviewer7.0安装后如何正确注册License许可证,激活使用
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并2
  • ¥66 关于人体营养与饮食规划的线性规划模型
  • ¥15 基于深度学习的快递面单识别系统
  • ¥15 Multisim仿真设计地铁到站提醒电路
  • ¥15 怎么用一个500W电源给5台60W的电脑供电
  • ¥15 请推荐一个轻量级规则引擎,配合流程引擎使用,规则引擎负责判断出符合规则的流程引擎模板id
  • ¥15 Excel表只有年月怎么计算年龄