admin管理员组文章数量:1404924
I have a locally hosted site that uses bootstrap to create a carousel with pictures from the upload folder. I currently have the bootstrap markup using the source of the pictures, but I fear when I load the site to a live server those links are not going to work anymore?
Is there a dynamic way to get to the upload folder, maybe with the use of an inbuilt WordPress function, so that the path to the pictures that are used in the carousel always work?
I have a locally hosted site that uses bootstrap to create a carousel with pictures from the upload folder. I currently have the bootstrap markup using the source of the pictures, but I fear when I load the site to a live server those links are not going to work anymore?
Is there a dynamic way to get to the upload folder, maybe with the use of an inbuilt WordPress function, so that the path to the pictures that are used in the carousel always work?
Share Improve this question asked Dec 26, 2019 at 10:37 Neil MeyerNeil Meyer 1137 bronze badges1 Answer
Reset to default 1Take a look at wp_upload_dir
here https://developer.wordpress/reference/functions/wp_upload_dir/
$upload_dir = wp_upload_dir();
var_dump( $upload_dir );
/*
$upload_dir will comprise of the following return values:
'path' - (string) Base directory and subdirectory or full path to upload directory.
'url' - (string) Base URL and subdirectory or absolute URL to upload directory.
'subdir' - (string) Subdirectory if uploads use year/month folders option is on.
'basedir' - (string) Path without subdir.
'baseurl' - (string) URL path without subdir.
'error' - (string|false) False or error message.
*/
本文标签: customizationIs there a way to dynamically get to your uploads folder
版权声明:本文标题:customization - Is there a way to dynamically get to your uploads folder? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744879065a2630095.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论