Title: McNinja Post Styles
Author: TomHarrigan
Published: <strong>2014 年 5 月 28 日</strong>
Last modified: 2015 年 1 月 7 日

---

搜索插件

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

![](https://s.w.org/plugins/geopattern-icon/mcninja-post-styles.svg)

# McNinja Post Styles

 作者：[TomHarrigan](https://profiles.wordpress.org/tomharrigan/)

[下载](https://downloads.wordpress.org/plugin/mcninja-post-styles.zip)

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

 [支持](https://wordpress.org/support/plugin/mcninja-post-styles/)

## 描述

Go to the homepage or blog page of a site, chances are, all of the posts look similar:
A title, an excerpt and a featured image. Why not display the most important part
of your posts to readers and actually give them a reason to click on your post a
read it? That’s what this plugin does.

To enable Post Style formatting functionality, go to Settings->Reading and select“
Enable Post Style formatting.”

McNinja Post Styles is what we always wanted Post Formats to be: powerful, flexible
and extendable. Unleash the creativity of your content.

McNinja Post Styles can display content based on the Post Style of a post. For example,
if your post has a video in it and you’ve selected the ‘Video’ style, your blog 
page, category pages, etc. will display that video rather than an excerpt.

Post Styles can be selected for a Post from the ‘Edit Post’ screen.

For more information or to follow the project, check out the [project page](http://thomasharrigan.com/mcninja-post-styles/).

McNinja Post Styles…

 * Allows authors to choose how to display a Post
 * Supports all of the formats added by Post Formats (aside, gallery, link, image,
   quote, status, video, audio, chat) so that if your theme made use of Post Formats,
   the same templates can be used.

## 屏幕截图

[⌊Example of posts utlizing Post Styles with 'video', 'image', and 'standard' post
styles.⌉⌊Example of posts utlizing Post Styles with 'video', 'image', and 'standard'
post styles.⌉[

Example of posts utlizing Post Styles with ‘video’, ‘image’, and ‘standard’ post
styles.

[⌊A post excerpt using the Gallery post style⌉⌊A post excerpt using the Gallery 
post style⌉[

A post excerpt using the Gallery post style

[⌊A post excerpt using the Playlist post style⌉⌊A post excerpt using the Playlist
post style⌉[

A post excerpt using the Playlist post style

[⌊A post excerpt using the List post style⌉⌊A post excerpt using the List post style⌉[

A post excerpt using the List post style

[⌊A post excerpt using the Video post style⌉⌊A post excerpt using the Video post
style⌉[

A post excerpt using the Video post style

[⌊A post excerpt using the Embed post style⌉⌊A post excerpt using the Embed post
style⌉[

A post excerpt using the Embed post style

[⌊A post excerpt using the Quote post style⌉⌊A post excerpt using the Quote post
style⌉[

A post excerpt using the Quote post style

[⌊The metabox added to the Post Edit screen⌉⌊The metabox added to the Post Edit 
screen⌉[

The metabox added to the Post Edit screen

[⌊Option on Settings -> Reading screen to enable Post Style formatting⌉⌊Option on
Settings -> Reading screen to enable Post Style formatting⌉[

Option on Settings -> Reading screen to enable Post Style formatting

## 安装

#### Using The WordPress Dashboard

 1. Navigate to the ‘Add New’ Plugin Dashboard
 2. Select `mcninja-post-styles.zip` from your computer
 3. Upload
 4. Activate the plugin on the WordPress Plugin Dashboard

#### Using FTP

 1. Extract `mcninja-post-styles.zip` to your computer
 2. Upload the `mcninja-post-styles` directory to your `wp-content/plugins` directory
 3. Activate the plugin on the WordPress Plugins dashboard

## 常见问题

  How do I make use of Post Styles?

Simply go to Settings->Reading and select “Enable Post Style formatting”, save your
changes, and you’re ready to roll!

  How do I use Post Styles to display custom theme templates I’ve created?

In your loop or other area in which displaying a content template, change your get_template_part
call to the following:

get_template_part( ‘content’, get_post_style() );

get_post_style() will return the slug of the selected post style, for example, if
a post is using the ‘image’ Post Style, then get_template_part will be looking to
use content-image.php to display the post.

  What template will be used if the ‘Standard’ post style (default) is selected?

By default, it will look for content-post.php, if there is no content-post.php, 
it will use content.php

  How do I add CSS to a specific Post Style?

Posts will have a class associated with their style. The class name is in the form
of ‘post-style-(slug-name)’, so a post using ‘image’ can be targeted with the ‘.
post-style-image’ class.

  How do I add a new Post Style?

The ‘post_style_strings’ filter allows you to add new styles. It provides an array
of Post Styles and you can add your new post style. The example below adds a new
post style named ‘Golden Unicorn’, with a slug ‘golden-unicorn’.

function my_new_custom_post_style( $strings ) {
 $strings[‘golden-unicorn’] = _x(‘
Golden Unicorn’, ‘Post style’ ); return $strings; } add_filter( ‘post_style_strings’,‘
my_new_custom_post_style’);

  Why aren’t there template files?

This plugin provides the mechanism for allowing custom post formats. It is basically
a glorified taxonomy. It is up to themes and developers to utlize this. I’ll be 
writing some tutorials and examples on my blog shortly though. Feel free to shoot
me an email or contact me in the meantime.

## 评价

此插件暂无评价。

## 贡献者及开发者

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

贡献者

 *   [ TomHarrigan ](https://profiles.wordpress.org/tomharrigan/)

[帮助将「McNinja Post Styles」翻译成简体中文。](https://translate.wordpress.org/projects/wp-plugins/mcninja-post-styles)

### 对开发感兴趣吗?

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

## 更新日志

#### 2.0.1

 * Add content formatting for Image post style
 * Documentation update

#### 2.0

 * Add content formatting based on Post Style
 * Add option in Settings -> Reading to enable Post Style formatting
 * Add “Embed” Post Style
 * Add “Chat” Post Style
 * Add “Playlist” Post Style

#### 1.1

 * Expose get_post_style_link() function
 * Expose get_post_style_string() function
 * i18n support: add .pot file and make strings translateable
 * Add backwards compatibility with post-format CSS classes for themes already implementing
   post formats

#### 1.0

 * Initial release

## 额外信息

 *  版本 **2.0.1**
 *  最后更新：**12 年前**
 *  活跃安装数量 **20+**
 *  WordPress 版本 ** 3.1 或更高版本 **
 *  已测试的最高版本为 **4.1.42**
 *  语言
 * [English (US)](https://wordpress.org/plugins/mcninja-post-styles/)
 * 标签
 * [excerpt](https://cn.wordpress.org/plugins/tags/excerpt/)[formatting](https://cn.wordpress.org/plugins/tags/formatting/)
   [post formats](https://cn.wordpress.org/plugins/tags/post-formats/)[style](https://cn.wordpress.org/plugins/tags/style/)
   [taxonomy](https://cn.wordpress.org/plugins/tags/taxonomy/)
 *  [高级视图](https://cn.wordpress.org/plugins/mcninja-post-styles/advanced/)

## 评级

 5 星（最高 5 星）。

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

[您的评价](https://wordpress.org/support/plugin/mcninja-post-styles/reviews/#new-post)

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

## 贡献者

 *   [ TomHarrigan ](https://profiles.wordpress.org/tomharrigan/)

## 支持

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

 [查看支持论坛](https://wordpress.org/support/plugin/mcninja-post-styles/)