Changeset 2685416
- Timestamp:
- 02/26/2022 07:08:42 PM (3 years ago)
- Location:
- basic-url-shortcodes/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
basic-url-shortcodes/trunk/readme.txt
r2685415 r2685416 11 11 == Description == 12 12 Sometimes you want to put the base URL (that of the blog, or that of the active template) in your content editor. Times when the template customising isn't quite flexible enough. 13 With this plugin you can use [home_url] to output the base URL of the blog (as set in your Settings). Or, you can use [theme_url_template] to output the URL of the active template. 13 With this plugin you can use [home_url] to output the base URL of the blog (as set in your Settings). Or, you can use [theme_url_template] to output the URL of the active template. And You can use the [UPLOAD_URL] to output the URL of the upload folder. 14 14 15 For example `<img src="[ home_url]/test.png" />` in your editor might output `<img src="http://localhost/wp-demo/test.png" />` (if http://localhost/wp-demo is what you have configured as your blog URL in Settings).15 For example `<img src="[UPLOAD_URL]/2022/02/test.png />` in your editor might output `<img src="http://localhost/wp-demo/wp-content/uploads/2022/02/test.png" />` (if http://localhost/wp-demo is what you have configured as your blog URL in Settings). 16 16 17 17 The supported short codes are as follows: 18 18 * [home_url] - the configured blog URL (set in Settings). E.g. http://localhost/wp-demo 19 19 * [theme_url_template] - the URL of the active template. E.g. http://localhost/wp-demo/wp-content/themes/mytheme 20 * [UPLOAD_URL] - the URL of the upload folder. E.g. http://localhost/wp-demo/wp-content/uploads 20 21 21 22 == Installation == -
basic-url-shortcodes/trunk/ro_burl_short_codes.php
r1699763 r2685416 3 3 Plugin Name: BASIC URL ShortCodes 4 4 Plugin URI: https://wordpress.org/plugins/basic-url-shortcodes/ 5 Description: Adds support for a [home_url] and [theme_url_template] short-codes for use in your post/page editor.6 Version: 4.0 5 Description: Adds support for a [home_url], [theme_url_template] and [UPLOAD_URL] short-codes for use in your post/page editor. 6 Version: 4.0.1 7 7 Author: Vikas Sharma 8 8 Author URI: https://profiles.wordpress.org/devikas301 … … 10 10 11 11 // [home_url] 12 function ro _home_url_function(){13 return get_bloginfo( "url");12 function roHomeUrlFunction(){ 13 return get_bloginfo("url"); 14 14 } 15 add_shortcode('home_url', 'ro_home_url_function');15 add_shortcode('home_url','roHomeUrlFunction'); 16 16 17 17 // [theme_url_template] 18 function ro _url_template_function(){19 if( get_theme_root_uri() && get_template() ){20 return get_theme_root_uri() . "/" .get_template();18 function roUrlTemplateFunction(){ 19 if(get_theme_root_uri() && get_template()){ 20 return get_theme_root_uri()."/".get_template(); 21 21 } else { 22 22 return ""; 23 23 } 24 24 } 25 add_shortcode('theme_url_template', 'ro_url_template_function'); 25 add_shortcode('theme_url_template','roUrlTemplateFunction'); 26 27 // [UPLOAD_URL] 28 function roUploadUrlFunction(){ 29 $upload_dir = wp_upload_dir(); 30 if(!empty($upload_dir['baseurl'])){ 31 return $upload_dir['baseurl']; 32 } else { 33 return ""; 34 } 35 } 36 add_shortcode('UPLOAD_URL', 'roUploadUrlFunction'); 26 37 ?>
Note: See TracChangeset
for help on using the changeset viewer.