W 3 S y l l a b u s

Loading

Welcome to

W3Syllabus

shapeshapeshapeshapeshapeshape

WordPress General Dynamic URL Reference

By W3Syllabus.com
icon CMS
9 Views
Retrieve Site URL

Use site_url() to get the site’s base URL dynamically:

				
					<?php echo site_url(); ?>

				
			

Example Output:
http://localhost/drpam

Use home_url() to get the site’s home URL dynamically (useful if WordPress is installed in a subdirectory):

				
					<?php echo home_url(); ?>
				
			

Example Output:
http://localhost/website

If you need the URL of your theme folder:

				
					<?php echo get_template_directory_uri(); ?>
				
			

Example Output:
http://localhost/website/wp-content/themes/your-theme-name

If you’re working with a child theme:

				
					<?php echo get_stylesheet_directory_uri(); ?>
				
			

Example Output:
http://localhost/drpam/wp-content/themes/your-child-theme-name

If you need the URL of the uploads directory:

				
					<?php echo wp_get_upload_dir()['baseurl']; ?>
				
			

Example Output:
http://localhost/drpam/wp-content/uploads

Courses You May Like

CMS

How can I configure WordPress to handle updates, plugin installations, and theme installations directly without using FTP or FTPS?

Shared or CPanel Hosting To enable FTPS (FTP over SSL) for updates or plugin/theme installations in WordPress via […]

CMS

How to add a new blog post in WordPress?

To add a new blog post in WordPress, follow these steps: Log in to Your WordPress Dashboard: – […]

CMS

Adding and Managing Products in WooCommerce

Adding a product Before adding your first product, let’s get familiar with how product categories, tags, and attributes work. Product […]

shape
shape
shape
shape
Newsletter

Subscribe Our Newsletter

thumb
thumb
+15k

More than 15k active users!

Join them now