Title: Featured Audio
Author: Nick Halsey
Published: <strong>2016 年 7 月 12 日</strong>
Last modified: 2024 年 7 月 12 日

---

搜索插件

**该插件尚未通过WordPress的最新3个主要版本进行测试**。 当与较新版本的WordPress一起
使用时，可能不再受到维护或支持，并且可能会存在兼容性问题。

![](https://ps.w.org/featured-audio/assets/icon.svg?rev=1453109)

# Featured Audio

 作者：[Nick Halsey](https://profiles.wordpress.org/celloexpressions/)

[下载](https://downloads.wordpress.org/plugin/featured-audio.1.2.zip)

 * [详情](https://cn.wordpress.org/plugins/featured-audio/#description)
 * [评价](https://cn.wordpress.org/plugins/featured-audio/#reviews)
 *  [安装](https://cn.wordpress.org/plugins/featured-audio/#installation)
 * [开发进展](https://cn.wordpress.org/plugins/featured-audio/#developers)

 [支持](https://wordpress.org/support/plugin/featured-audio/)

## 描述

WordPress supports featured images out of the box, allowing images to represent 
posts in various ways defined by the theme. This plugin adds similar support for
audio, allowing musicians, podcasters, and anyone who publishes audio with WordPress
to feature audio files on posts and pages in a structured way. Each post and page
gets a featured audio metabox where an audio file can be uploaded or selected from
the media library.

By default, featured audio is displayed at the top of posts and pages `(within the_content)`.
Developers can change this by adding theme support for `featured-audio`, via several
API functions listed below.

Why use featured audio instead of embeding audio directly into posts? Featured audio
organizes the content in a structured way, alowing infinite possibilities to customize
the way users experience audio content on your site. The plugin ships with one example
of this – the featured audio playlist widget. Add this widget to your sidebar and
it’ll automatically display a playlist of all of the audio files featured on posts
shown on the current view, on views with more than one post such as the main blog
page or a category page. The plugin also supports a recent audio playlist widget,
which behaves similarly to a latest posts widget.

For a more comprehensive way to manage _music_ with WordPress, particularly if you
need to include sheet music alongisde audio, see the [Sheet Music Library](https://wordpress.org/plugins/sheet-music-library/)
plugin.

### Developer API Functions

#### Add Theme Support

    ```
    add_theme_support( 'featured-audio' )
    ```

Adding theme support for featured audio tells the plugin not to add the featured
audio to the content automatically. Instead, you can add featured audio exactly 
where you want it with `the_featured_content()` (see below for details).

#### Change Supported Post Types

By default, the `post` and `page` post types are supported. You can use the `featured_audio_post_types`
filter to modify this list. For example:

    ```
    add_filter( 'featured_audio_post_types', 'prefix_featured_audio_post_types' );
    function prefix_featured_audio_post_types( $post_types ) {
        // Add support to the sheet_music post type.
        $post_types[] = 'sheet_music';

        // Overwrite the entire list to remove support on pages.
        $post_types = array( 'post' );

        return $post_types;
    }
    ```

#### the_featured_audio( $args )

Display the featured audio, if it exists.

Parameters:

    ```
    $args                   array   Display options.
    $args['id']             int     Post id (optional). Defaults to current post id. 
    $args['album_art']      boolean Whether to display the album art for the featured audio cycle. Default: false.
    $args['album_art_size'] string  Size to use for the album art picture. Default: thumbnail.
    $args['title']          boolean Whether to display the title of the audio attachment. Default: false.
    ```

#### get_the_featured_audio( $args )

Get the featured audio, if it exists, as a string. Has the same arguments as `the_featured_audio()`.

#### get_featured_audio_src( $id )

Returns the url of the featured audio file, if it exists.

Parameter:

    ```
    $id int Post id (optional). Defaults to current post id.
    ```

#### get_featured_audio_attachment_id( $id )

Returns the id of the featured audio attachment, if it exists.

Parameter:

    ```
    $id int Post id (optional). Defaults to current post id.
    ```

#### get_the_featured_audio_playlist()

Get the featured audio playlist, if there are multiple posts with featured audio
in the current query. Used by the featured audio playlist widget.

#### the_featured_audio_playlist()

Displays (echoes) `get_the_featured_audio_playlist()`.

## 屏幕截图

 * [[
 * Featured audio metabox on the post edit screen in the admin.
 * [[
 * Default featured audio dislpay with the Twenty Fifteen theme.
 * [[
 * Custom featured audio display using `the_featured_audio( array( 'title' => true,'
   album_art' => true ) );` in a theme.
 * [[
 * Featured Audio Playlist Widget display with the Twenty Fifteen theme.
 * [[
 * Featured Audio Playlist Widget display in the customizer.
 * [[
 * Example of a [Chromeless Widgets page](https://wordpress.org/plugins/chromeless-widgets-page/)
   featuring all of the audio on a site (also via the Sheet Music library plugin),
   with playlist widgets. [See the live page here](https://celloexpressions.com/music/playlists/).

## 安装

 1. Take the easy route and install through the WordPress plugin adder OR
 2. Download the .zip file and upload the unzipped folder to the `/wp-content/plugins/`
    directory
 3. Activate the plugin through the ‘Plugins’ menu in WordPress
 4. Add featured audio to your posts and pages, and optionally add the featured audio
    playlist or recent audio playlist widget to a sidebar.
 5. Developers can add support for additional post types and customize the display 
    of featured audio in themes. You can also customize the display with custom CSS
    in the customizer.

## 常见问题

### How do I change where featured audio is displayed?

See the “Developer API Functions” section for information on how to change where
featured audio is displayed in your theme’s code.

### How does the playlist widget work?

The featued audio playlist widget pulls in the featured audio associated with all
of the posts displayed on the current view (auch as the blog index, a taxonomy archive,
or an author archive). It won’t display on single post or page views or on archive
views where none of the posts have featured audio selected.

## 评价

![](https://secure.gravatar.com/avatar/d5e8e9b66b13766cd3129ad2f50e6a447f93d7b3fa62151ffae3450b32c1118d?
s=60&d=retro&r=g)

### 󠀁[A great idea!](https://wordpress.org/support/topic/a-great-idea-5/)󠁿

 [Gin](https://profiles.wordpress.org/rawdolphe/) 2024 年 2 月 16 日

Thank you Nick, would love to see a Gutenberg Block for it! Featured Audio should
be part of WordPress Core.

![](https://secure.gravatar.com/avatar/a1c6d2af4d0f2658112a6fa5a1fd4b2ef8d2eb4c7f01bb20677e1b033c2472ba?
s=60&d=retro&r=g)

### 󠀁[Very useful](https://wordpress.org/support/topic/very-useful-963/)󠁿

 [aicart](https://profiles.wordpress.org/aicart/) 2016 年 9 月 3 日

It is very useful! Thanks a lot.

![](https://secure.gravatar.com/avatar/5954a9f0b16f0328b4e07453044c7db44fa6ad32b235bd6baf4a9200511da32d?
s=60&d=retro&r=g)

### 󠀁[Nice tools to organize audio](https://wordpress.org/support/topic/nice-tools-to-organize-audio/)󠁿

 [Midwest_Bob](https://profiles.wordpress.org/midwest_bob/) 2016 年 9 月 3 日

Like the description states, this is a clever way to organize and offer audio content
on a website.

 [ 阅读所有3条评价 ](https://wordpress.org/support/plugin/featured-audio/reviews/)

## 贡献者及开发者

「Featured Audio」是开源软件。 以下人员对此插件做出了贡献。

贡献者

 *   [ Nick Halsey ](https://profiles.wordpress.org/celloexpressions/)

[帮助将「Featured Audio」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/featured-audio)

### 对开发感兴趣吗?

您可以[浏览代码](https://plugins.trac.wordpress.org/browser/featured-audio/)，查看
[SVN仓库](https://plugins.svn.wordpress.org/featured-audio/)，或通过[RSS](https://plugins.trac.wordpress.org/log/featured-audio/?limit=100&mode=stop_on_copy&format=rss)
订阅[开发日志](https://plugins.trac.wordpress.org/log/featured-audio/)。

## 更新日志

#### 1.2

 * Declare compatibility with the block editor in WordPress 5.0.

#### 1.1

 * Introduce a recent featured audio playlist widget.
 * Fixes and improvements to the `get_the_featured_audio()` function, props @jangeekho.

#### 1.0

 * Initial public release.

## 额外信息

 *  版本 **1.2**
 *  最后更新：**2 年前**
 *  活跃安装数量 **400+**
 *  WordPress 版本 ** 4.5 或更高版本 **
 *  已测试的最高版本为 **6.6.5**
 *  语言
 * [English (US)](https://wordpress.org/plugins/featured-audio/)
 * 标签
 * [audio](https://cn.wordpress.org/plugins/tags/audio/)[media](https://cn.wordpress.org/plugins/tags/media/)
   [music](https://cn.wordpress.org/plugins/tags/music/)[podcast](https://cn.wordpress.org/plugins/tags/podcast/)
 *  [高级视图](https://cn.wordpress.org/plugins/featured-audio/advanced/)

## 评级

 5 星（最高 5 星）。

 *  [  3 条 5 星评价     ](https://wordpress.org/support/plugin/featured-audio/reviews/?filter=5)
 *  [  0 条 4 星评价     ](https://wordpress.org/support/plugin/featured-audio/reviews/?filter=4)
 *  [  0 条 3 星评价     ](https://wordpress.org/support/plugin/featured-audio/reviews/?filter=3)
 *  [  0 条 2 星评价     ](https://wordpress.org/support/plugin/featured-audio/reviews/?filter=2)
 *  [  0 条 1 星评价     ](https://wordpress.org/support/plugin/featured-audio/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/featured-audio/reviews/#new-post)

[查看全部评论](https://wordpress.org/support/plugin/featured-audio/reviews/)

## 贡献者

 *   [ Nick Halsey ](https://profiles.wordpress.org/celloexpressions/)

## 支持

有话要说吗？是否需要帮助？

 [查看支持论坛](https://wordpress.org/support/plugin/featured-audio/)