国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home CMS Tutorial WordPress What are the commonly used functions in wordpress templates?

What are the commonly used functions in wordpress templates?

Nov 18, 2019 pm 03:20 PM
wordpress Commonly used functions template

What are the commonly used functions in wordpress templates?

What are the commonly used functions in wordpress templates

If you are a newbie in wordpress, then these functions are useful to you It is said to be very useful. For example, if you like a certain theme but need to change it to suit your requirements, then you must know these functions and names

1. Basic template file

style.css : CSS(樣式表)文件
index.php : 主頁(yè)模板
archive.php : Archive/Category模板
404.php : Not Found 錯(cuò)誤頁(yè)模板
comments.php : 留言/回復(fù)模板
footer.php : Footer模板
header.php : Header模板
sidebar.php : 側(cè)欄模板
page.php : 內(nèi)容頁(yè)(Page)模板
single.php : 內(nèi)容頁(yè)(Post)模板
searchform.php : 搜索表單模板
search.php : 搜索結(jié)果模板

2. Basic condition judgment Tag

is_home() : 是否為主頁(yè)
is_single() : 是否為內(nèi)容頁(yè)
(Post) is_page() : 是否為內(nèi)容頁(yè)
(Page) is_category() : 是否為Category/Archive頁(yè)
is_tag() : 是否為Tag存檔頁(yè)
is_date() : 是否為指定日期存檔頁(yè)
is_year() : 是否為指定年份存檔頁(yè)
is_month() : 是否為指定月份存檔頁(yè)
is_day() : 是否為指定日存檔頁(yè)
is_time() : 是否為指定時(shí)間存檔頁(yè)
is_archive() : 是否為存檔頁(yè)
is_search() : 是否為搜索結(jié)果頁(yè)
is_404() : 是否為 “HTTP 404: Not Found” 錯(cuò)誤頁(yè)
is_paged() : 主頁(yè)/Category/Archive頁(yè)是否以多頁(yè)顯示

3. Header part PHP function

<!–p bloginfo(’name’);–>: 博客名稱(Title)
<!–p bloginfo(’stylesheet_url’);–>: CSS文件路徑
<!–p bloginfo(’pingback_url’);–>: PingBack Url
<!–p bloginfo(’template_url’);–>: 模板文件路徑
<!–p bloginfo(’version’);–>: WordPress版本
<!–p bloginfo(’atom_url’);–>: Atom Url
<!–p bloginfo(’rss2_url’);–>: RSS 2.o Url
<!–p bloginfo(’url’);–>: 博客 Url
<!–p bloginfo(’html_type’);–>: 博客網(wǎng)頁(yè)Html類型
<!–p bloginfo(’charset’);–>: 博客網(wǎng)頁(yè)編碼
<!–p bloginfo(’description’);–>: 博客描述
<!–p wp_title();–>: 特定內(nèi)容頁(yè)(Post/Page)的標(biāo)題

4. Template PHP functions and commands

<!–p get_header();–>: 調(diào)用Header模板
<!–p get_sidebar();–>: 調(diào)用Sidebar模板
<!–p get_footer();–>: 調(diào)用Footer模板
<!–p the_content();–>: 顯示內(nèi)容(Post/Page)
<!–p if(have_posts()) :–>: 檢查是否存在Post/Page
<!–p while(have_posts()) : the_post();–>: 如果存在Post/Page則予以顯示
<!–p endwhile;–>: While 結(jié)束
<!–p endif;–>: If 結(jié)束
<!–p the_time(’字符串’)–>: 顯示時(shí)間,時(shí)間格式由“字符串”參數(shù)決定,具體參考PHP手冊(cè)
<!–p comments_popup_link();–>: 正文中的留言鏈接。如果使用 comments_popup_script() ,則留言會(huì)在新窗口中打開,反之,則在當(dāng)前窗口打開
<!–p the_title();–>: 內(nèi)容頁(yè)(Post/Page)標(biāo)題
<!–p the_permalink()–>: 內(nèi)容頁(yè)(Post/Page) Url
<!–p the_category(’,’)–>: 特定內(nèi)容頁(yè)(Post/Page)所屬Category
<!–p the_author();–>: 作者
<!–p the_ID();–>: 特定內(nèi)容頁(yè)(Post/Page) ID
<!–p edit_post_link();–>: 如果用戶已登錄并具有權(quán)限,顯示編輯鏈接
<!–p get_links_list();–>: 顯示Blogroll中的鏈接
<!–p comments_template();–>: 調(diào)用留言/回復(fù)模板
<!–p wp_list_pages();–>: 顯示Page列表
<!–p wp_list_categories();–>: 顯示Categories列表
<!–p next_post_link(’%link’);–>: 下一篇文章鏈接
<!–p previous_post_link(’%link’);–>: 上一篇文章鏈接
<!–p get_calendar();–>: 日歷
<!–p wp_get_archives()–>: 顯示內(nèi)容存檔
<!–p posts_nav_link();–>: 導(dǎo)航,顯示上一篇/下一篇文章鏈接
<!–p include(TEMPLATEPATH . ‘/文件名’);–>: 嵌入其他文件,可為定制的模板或其他類型文件

5. Other template-related functions

<!–p _e(’Message’);–>: 輸出相應(yīng)信息
<!–p wp_register();–>: 顯示注冊(cè)鏈接
<!–p wp_loginout();–>: 顯示登錄/注銷鏈接
<!–ext pag–>: 將當(dāng)前內(nèi)容分頁(yè)
<!–or–>: 將當(dāng)前內(nèi)容截?cái)?,以不在主?yè)/目錄頁(yè)顯示全部?jī)?nèi)容
<!–p timer_stop(1);–>: 網(wǎng)頁(yè)加載時(shí)間(秒)
<!–p echo get_num_queries();–>: 網(wǎng)頁(yè)加載查詢量

Of course, WordPress has far more functions than these. If you have higher For requirements, please visit WordPress official code page.

Recommended tutorial: WordPress tutorial

The above is the detailed content of What are the commonly used functions in wordpress templates?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to adjust the wordpress article list How to adjust the wordpress article list Apr 20, 2025 am 10:48 AM

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

10 latest tools for web developers 10 latest tools for web developers May 07, 2025 pm 04:48 PM

Web development design is a promising career field. However, this industry also faces many challenges. As more businesses and brands turn to the online marketplace, web developers have the opportunity to demonstrate their skills and succeed in their careers. However, as demand for web development continues to grow, the number of developers is also increasing, resulting in increasingly fierce competition. But it’s exciting that if you have the talent and will, you can always find new ways to create unique designs and ideas. As a web developer, you may need to keep looking for new tools and resources. These new tools and resources not only make your job more convenient, but also improve the quality of your work, thus helping you win more business and customers. The trends of web development are constantly changing.

How to import the source code of wordpress How to import the source code of wordpress Apr 20, 2025 am 11:24 AM

Importing WordPress source code requires the following steps: Create a sub-theme for theme modification. Import the source code and overwrite the files in the sub-topic. Activate the sub-theme to make it effective. Test the changes to make sure everything works.

How to build a website for wordpress host How to build a website for wordpress host Apr 20, 2025 am 11:12 AM

To build a website using WordPress hosting, you need to: select a reliable hosting provider. Buy a domain name. Set up a WordPress hosting account. Select a topic. Add pages and articles. Install the plug-in. Customize your website. Publish your website.

How to add your WordPress site in Yandex Webmaster Tools How to add your WordPress site in Yandex Webmaster Tools May 12, 2025 pm 09:06 PM

Do you want to connect your website to Yandex Webmaster Tools? Webmaster tools such as Google Search Console, Bing and Yandex can help you optimize your website, monitor traffic, manage robots.txt, check for website errors, and more. In this article, we will share how to add your WordPress website to the Yandex Webmaster Tool to monitor your search engine traffic. What is Yandex? Yandex is a popular search engine based in Russia, similar to Google and Bing. You can excel in Yandex

How to set, get and delete WordPress cookies (like a professional) How to set, get and delete WordPress cookies (like a professional) May 12, 2025 pm 08:57 PM

Do you want to know how to use cookies on your WordPress website? Cookies are useful tools for storing temporary information in users’ browsers. You can use this information to enhance the user experience through personalization and behavioral targeting. In this ultimate guide, we will show you how to set, get, and delete WordPresscookies like a professional. Note: This is an advanced tutorial. It requires you to be proficient in HTML, CSS, WordPress websites and PHP. What are cookies? Cookies are created and stored when users visit websites.

How to fix HTTP image upload errors in WordPress (simple) How to fix HTTP image upload errors in WordPress (simple) May 12, 2025 pm 09:03 PM

Do you need to fix HTTP image upload errors in WordPress? This error can be particularly frustrating when you create content in WordPress. This usually happens when you upload images or other files to your CMS using the built-in WordPress media library. In this article, we will show you how to easily fix HTTP image upload errors in WordPress. What is the reason for HTTP errors during WordPress media uploading? When you try to upload files to Wo using WordPress media uploader

How to register a wordpress account How to register a wordpress account Apr 20, 2025 am 11:45 AM

To create an account on WordPress, simply visit its website, select the registration option, fill in the registration form, and verify your email address. Other ways to register include using a Google account or Apple ID. The benefits of signing up include creating a website, gaining features, joining the community, and gaining support.

See all articles