About PHP functions for getting home page and site links in WordPress

Source: Internet
Author: User
Home_url () (Get home link)
The Ome_url () function is used to get the homepage link of WordPress.

Usage

Home_url ($path, $scheme);

Parameters

$path

(string) (optional) The appended content behind the homepage link is a relative link.

Default value: None

$scheme

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

Default value: null

return value

(string) Returns the first page URL plus $path parameter.

Example

Echo Home_url ();//output: Http://www.example.comecho 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 the site link for WordPress.

Usage

Site_url ($path, $scheme);

Parameters

$path

(string) (optional) the content appended after the link.

Default value: None

$scheme

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

Default value: null

return value

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

Example

echo Site_url ();//output: http://www.example.com or Http://www.example.com/wordpressecho 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

The above describes the introduction of WordPress to get home page and site link PHP function, including the content of the contents, I hope that the PHP tutorial interested in a friend helpful.

  • 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.