Home CMS Tutorial WordPress What are the new features of WordPress 2.9?

What are the new features of WordPress 2.9?

Nov 04, 2019 am 11:18 AM
new function

What are the new features of WordPress 2.9?

1. Article thumbnails

One of the more important new features of WordPress 2.9 is the article thumbnail function that does not require custom fields. , which will provide great convenience to users, but due to some compatibility restrictions, you must modify the theme’s function.php file to use this feature.

Add the following code to the theme’s function.php, and you will be able to use the WordPress post thumbnail function.

if ( function_exists( 'add_theme_support' ) ) { //检查WP版本是否为2.9或以上版本 
add_theme_support('post-thumbnails'); //如果WP版本符合最低要求则添加文章缩略图 
}
Copy after login

Then add some code to the article list call to display article thumbnails.

if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { 
echo '' . the_post_thumbnail() . ''; 
}
Copy after login
/*如果支持文章缩略图,并且该文章存在缩略图,则显示缩略图,否则显示默认图片*/
  使文章缩略图显示美观的重点是 the_post_thumbnail() 函数的定义,以下代码提供一个简单的说明。
the_post_thumbnail(); //采用默认参数,请参考wp-includes/post-image-template.php文件 
the_post_thumbnail('thumbnail'); //小尺寸缩略图 
the_post_thumbnail('medium'); //中等缩略图 
the_post_thumbnail('large'); //大缩略图 
the_post_thumbnail('medium', array('class' => 'alignleft', 'alt' => 'alttext')); 
//采用中等缩略图 
//设定图片分辨率为100x100像素,并加上class="alignleft"和描述 
the_post_thumbnail(array(100,100), array('class' => 'alignleft', 'alt' => 'alttext'));
Copy after login

2. Sidebar description function

Widget support is a successful attempt by WordPress, which allows users to flexibly customize the content displayed in the sidebar. And provides great convenience for calling plug-ins. However, some themes support customizing multiple sidebars, which makes it difficult to install the Widget correctly. Sidebar descriptions appear more like bookmarks for widget-supported areas, so users can tell at a glance where the installed widget will appear.

The way to add a sidebar description is to add the following code to the theme's function.php file.

function register_theme_widget_areas() { //定义可以安装Widget的区域 
register_sidebar( array( //定义区域参数 
'name' => 'Primary', //侧边栏名称 
'id' => 'primary', //侧边栏id 
'description' => 'The primary widget area is used as top right sidebar.', //侧边栏描述 
'before_widget' => '
', 
'after_widget' => '
',

'before_title' => '
', 
'after_title' => '
'

/*以上四行都是定义Widget的样式,基本上和旧版本保持一致*/

) );

}
Copy after login

Recommended tutorial: wordpress tutorial

The above is the detailed content of What are the new features of WordPress 2.9?. 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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

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)

iPadOS18 new features iPadOS18 new features Jun 12, 2024 pm 10:41 PM

Early this morning, Apple officially released iPadOS18. This system not only has the classic functions of iOS18, but also adds some unique functions, such as supporting mathematical note calculators, etc., which further improves the experience of iPad users. Friends who are interested Come and take a look. This time iPadOS18 not only perfectly inherits the core functions of iOS18, such as the personalized control center design, which allows users to freely adjust the order and layout of control items according to personal preferences, and the highly anticipated game mode, providing gamers with smoother and more The immersive gaming experience also incorporates a number of unique features specifically targeting the iPad’s large screen advantages and the creative uses of Apple Pencil, further expanding the iPad’s productivity.

Microsoft Edge browser's new feature 'Super Drag” is now available! Microsoft Edge browser's new feature 'Super Drag” is now available! Mar 04, 2024 pm 06:31 PM

The editor recently learned that the new feature of Microsoft Edge browser "Super Drag" has been launched, unlocking the fourth way to open links in new tabs, making it easier for users to open links faster. Currently, in the Microsoft Edge browser, if users want to open a link or image in a new tab, there are three ways: 1. Right-click the link or image, and then select the corresponding operation option. 2. Drag the link or image to the tab bar. 3. Use the mouse wheel to click on the link or image. "Super Drag" brings a fourth kind of interaction, where users click on a link, part of text, or image and then drag it sideways, up, or down a little to open it in a new tab. After the user drags the text, the default search engine of the Edge browser will be called by default and a new tab will be opened.

WeChat launches new feature: 'Quiet Mode” WeChat launches new feature: 'Quiet Mode” Mar 04, 2024 pm 01:43 PM

It is understood that WeChat has launched a new feature: "Quiet Mode". After turning it on, WeChat will no longer make sounds in all scenarios such as message notifications, audio and video calls, and video account content playback. Update to the latest version of WeChat on iOS and turn it on through "WeChat" - "Me" - "Settings" - "Care Mode" - "Quiet Mode". After that, WeChat will no longer make sounds in all scenarios such as message notifications, audio and video calls, and video account content playback. WeChat said the feature was developed to meet the needs of those who cannot hear. For most people, sound may be very common and accessible, but they often ignore that the deaf community does not have this perception ability, although they also use mobile phones and WeChat like everyone else. according to

iOS18 new features revealed iOS18 new features revealed Mar 06, 2024 pm 02:25 PM

As Apple is about to release iOS 18, its major annual software update, this will undoubtedly become one of the hot and highly anticipated releases in 2024. According to rumors, this update will be regarded as one of the largest software upgrades in the history of the iPhone. Here is a brief summary of the relevant function upgrades. New iOS 18 feature revelations 1. It is reported that Apple may integrate the visionOS style into iOS 18. , giving people a refreshing operating experience. 2. According to rumors, the company is actively testing AI models and is expected to make major improvements to Siri on the iOS18 version. 3. In addition, Apple has recently launched a pilot program and launched a new tool called "Ask" to AppleCare, aiming to improve the efficiency of customer inquiries. 4

Windows 11 details new features Windows 11 details new features Dec 23, 2023 pm 03:37 PM

The new win11 operating system has brought many new functions and features to users, which are very novel, easy to use and powerful. Today we will bring you a detailed introduction to the new features of win11. If you are not sure, come here for details. Let’s find out. What are the new features of win11: 1. The new design of Win11 makes the UI look simple and beautiful, and more modern. 2. Microsoft said that the start menu and application icons in the center of the taskbar can allow users to find what they need more quickly. 3. The update package of Win11 is 40% less than that of Win10 on average, which means it saves more power and runs faster. 4. The speed of the built-in Edge browser has also been improved. On Win11, multiple task arrangement methods have been added.

Win11 preview version of Paint application update adds new hidden background, copy visible layers, etc. Win11 preview version of Paint application update adds new hidden background, copy visible layers, etc. Apr 11, 2024 pm 07:10 PM

In addition to Windows updates, Microsoft has also started pushing the latest Paint application update to Canary and Dev channels today, with version number 11.2402.32.0. This update improves brush sizes in Paint, adding new size sliders for the Pencil, Brush, and Eraser tools. In addition, Microsoft has further improved the layer functionality, such as adding a new background option in the layers panel, which allows users to set the background color of the canvas. As shown in the picture, you can open the layers panel and click the "Background" tile at the bottom, or use the Ctrl+Shift+B shortcut key. The color picker dialog box will be called up, and then you can select Make any color you like

Introduction to the latest features of win10 version 1903 Introduction to the latest features of win10 version 1903 Jan 01, 2024 pm 01:33 PM

After Microsoft once again launched a new version of win101903, friends must be curious to know what new features Microsoft has launched in this update. As far as the editor knows, in addition to fixing bugs and functional defects in the previous version, this update also adds new content such as built-in apps that can be uninstalled, acrylic effect LightTheme, black and white mixed backgrounds, etc. New features of win10 latest version 1903 1. Built-in applications can be uninstalled. The win10 system has various built-in applications. Now win101903 can uninstall some of the built-in applications. Uninstallation is limited to general applications. As for Edge and the App Store, it cannot be uninstalled. After all, it will involve many underlying functions of Win10. 2. LightTh with acrylic effect

An in-depth analysis of the new features of PHP8 and its improvement in development efficiency An in-depth analysis of the new features of PHP8 and its improvement in development efficiency Jan 13, 2024 am 11:33 AM

In-depth analysis of the new features of PHP8 to improve development efficiency! PHP8 is the latest version of the PHP programming language, officially released on November 26, 2020. This version brings many exciting new features and improvements that can greatly improve development efficiency. In this article, we’ll take a deep dive into some of PHP8’s new features and provide concrete code examples. 1. JIT compiler PHP8 introduces the JIT (Just-In-Time) compiler, which can compile some popular code blocks in real time, thereby improving

See all articles