【问题标题】:how to get theme url in wordpress static page如何在wordpress静态页面中获取主题网址
【发布时间】:2014-05-25 15:10:47
【问题描述】:

我是 wordpress 新手。我在我的 wordprees 网站中添加了一些静态页面。在动态页面中,我们可以通过 bloginfo('template_directory');但它不适用于静态页面。那么此代码用于静态页面的替代方法是什么。

【问题讨论】:

    标签: wordpress url static themes


    【解决方案1】:

    你可以使用一点 Javascript:

    location.pathname
    

    【讨论】:

      【解决方案2】:

      当然!使用这个功能:

      http://codex.wordpress.org/Function_Reference/get_template_directory_uri

      如果您有任何其他问题,请告诉我。

      【讨论】:

        【解决方案3】:

        我的问题已经解决了,谢谢回复。我使用简码在页面中获取主题链接

        //[主题网址] 函数主题url_func($atts){

        return bloginfo('template_directory');
        

        } add_shortcode('themeurl', 'themeurl_func');

        只需在页面中写入 [themeurl] 我们就可以在页面中获取主题网址

        【讨论】:

          猜你喜欢
          • 2011-03-16
          • 1970-01-01
          • 2020-07-21
          • 1970-01-01
          • 2012-03-24
          • 2017-01-30
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多