About WordPress to get home page and site links php function _php tips

Source: Internet
Author: User

Home_url () (Get home link)
Ome_url () function is used to get the homepage link of WordPress.

Usage

Home_url ($path, $scheme);

Parameters

$path

(optional) The content appended to the front page link is a relative link.

Default value: None

$scheme

(string) (optional) Link protocol that supports only "http", "https" and "relative".

Default value: null

return value

(string) returns the URL of the first page plus $path parameters.

Example

echo Home_url ()//output: http://www.example.com
echo home_url ('/');/output: http://www.example.com/
echo Home_url ('/', ' https ');/output: https://www.example.com/
echo home_url (' example ', ' relative ');/output:/example

Other
This function is located at: wp-includes/link-template.php


Site_url () (Get site link)
the Site_url () function is used to get WordPress site links.

Usage

Site_url ($path, $scheme);

Parameters

$path

(optional) The content appended after the link.

Default value: None

$scheme

(string) (optional) Link protocol that allows only "http", "https", "Login", "admin", and "relative".

Default value: null

return value

(string) returns the site link plus $path parameters.

Example

echo site_url ()//output: http://www.example.com or http://www.example.com/wordpress
echo site_url ('/secrets/', ' HTTPS ');//output: https://www.example.com/secrets/or https://www.example.com/wordpress/secrets/

Other

This function is located at: wp-includes/link-template.php


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.