Can I get a “base URL” in WordPress within a template file?

前端 未结 5 654
有刺的猬
有刺的猬 2021-02-01 03:57

Usually in my PHP apps I have a base URL setup so I can do things like this

tom/jones\">Tom
         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-01 03:58

    Yes, you can use get_bloginfo('url') just like that or define a constant...

    define('BASE_URL', get_bloginfo('url'));
    

    If you are working on a template and want the URL fragment to that theme folder, use...

    bloginfo('template_directory'); 
    

提交回复
热议问题