brian

  • WordPress functions: global variables $post, $page, $paged and $pages, etc

    WordPress has many built-in global variables, such as $post, $page, $paged and $pages. Almost all the data generated by WordPress can be found in the global variables. Reasonable use of these variables can bring a lot of convenience to WordPress development. How to use global variables Accessing global variables in WordPress If you want to access a global variable in your code, the first thing to do is to declare the variable as global: Global $variable; In addition, each global variable of WordPress can also be obtained through the corresponding...

    Technical Articles 02/03/2021
  • WordPress function: determine the type of page, such as home page, article page, search page

    WordPress is composed of home page, article page, search page and 404 page. When you want to show, hide, replace and load some content on a special page, you need to use page judgment function to judge. For example, in the article page and only when some content is displayed in the article page, you can use the function is_single() judgment. WordPress has rich built-in page judgment functions. The output of the judgment functions listed below is true under any conditions. In addition, these functions can accept parameters. Administrator panel...

    Technical Articles 02/03/2021
  • WordPress SEO Optimization: add og protocol tag

    If you look at the source code of some mainstream web sites, you can often see some meta tags of og: type, og: title and og: image in the HTTP header. What are these OG? What's the usage? In view of these problems, the insect fungus has sorted out the following information for you. What is OG protocol? After adding the og protocol, the head tag in the head of the web page source code will have the above effect. These OGS are short for open graph protocol, which was...

    Technical Articles 02/03/2021
  • WordPress function: get the general settings of blog_ bloginfo()、bloginfo()

    Function get_ Bloginfo() and bloginfo(), which can obtain information in WordPress user profile and general settings, such as blog title, blog address URL, WordPress version, etc. get_ Bloginfo() returns a string to call. Bloginfo() has echo property and can be output immediately. Function usage Function parameters $show (string) (optional) keyword to name the information you want. Default: name 'name' - returns the blog title set in Settings > general. This data can be downloaded from WP_ Options is retrieved from "blogname" in the table. 'description '- returns the subtitle set...

    Technical Articles 02/03/2021
  • WordPress function: page title tag acquisition, WP_ get_ document_ title()、wp_ Title () and title tag

    The title tag of WordPress is used to define the page title, WP_ get_ document_ title()、wp_ Both title () and title tag can get the title tag of WordPress. But note that as the WordPress version iterates, WP_ Title () has been abandoned. At present, the main function used is WP_ get_ document_ title()。 wp_ get_ document_ title() Basic usage WordPress version 4.4.0 started, adding a new function WP_ get_ document_ Title (), you only need to add the code above to the topic header.php Before the / head label...

    Technical Articles 02/03/2021
  • WordPress SEO Optimization: adding canonical tags to pure code

    Adding canonical tag to a website is a very important step in SEO optimization. rel = "canonical" can solve the problem of weight dispersion caused by different URLs but repeated content. At present, Baidu, Google, Yahoo, Microsoft and other search engines have supported this tag. Example demonstration https://www.nicebrian.com/ In order to avoid the dispersion of the weight of the home page, we should tell the search engine through the rrel = "canonical" tag that the weight of these two pages is mainly concentrated in the first web site. <link rel="canonical"...

    02/01/2021
  • How to speed up the picture loading speed of WordPress website?

    Image is very important to attract and keep readers' interest. However, they are also one of the slowest loading elements on the network. Slow loading may cause visitors to give up your website, so it is particularly important to solve the problem of slow loading of pictures! If you want a lighter and faster website, image optimization is a good starting point. Through optimization, you can continue to attract the audience's attention with beautiful and high-quality visual effects without significantly increasing the page loading time. In this article, we will...

    01/31/2021