【问题标题】:Linking to static html pages from wordpress blog从 wordpress 博客链接到静态 html 页面
【发布时间】:2013-09-22 16:23:54
【问题描述】:

我有一个包含几页的静态站点和一个 Wordpress 安装程序。我将 wordpress 上传到服务器,我可以使用链接 href="blog\" 从任何静态页面访问它。静态 html 页面存储在服务器的主目录中,该目录也是存储博客的位置。目录如下所示:

public_html/   //Server directory
-index.html
-contact.html
-about.html
-blog/         //Folder with blog installation
--wp-content/
---themes/
----theme_name/ 
-----file_with_links.php

我试图将链接放在 php 文件“file_with_links.php”中,该文件将链接回静态 html 页面,这些页面是它上面的几个目录。我尝试使用 ../../../../../page.html 没有运气。是否有捷径可寻?任何帮助将不胜感激。

-谢谢

【问题讨论】:

    标签: php html wordpress


    【解决方案1】:

    最佳做法是使用完整的 URI (http://YourSiteHere.com/YourFileHere.html)。

    为此,请在您的 file_with_links.php 文件中使用此代码:

    $root_toot = "http://YourSiteHere.com";
    
    $to_contact = '<a href="' . $root_toot . '/contact.html">Contact</a>';
    $to_about = '<a href="' . $root_toot . '/about.html">About</a>';
    

    等等

    【讨论】:

      猜你喜欢
      • 2013-09-07
      • 1970-01-01
      • 2021-07-06
      • 2021-11-21
      • 2016-04-26
      • 2016-04-03
      • 1970-01-01
      • 1970-01-01
      • 2014-03-15
      相关资源
      最近更新 更多