我从3.5开始就没有用过WP,所以请原谅我的粗鲁。我正试图为WP 3.9.1定制一个儿童主题214,使其更像一个企业网站,而不是一个杂志网站。
My goal: 为了让营销部门只需登录,请添加一个产品(帖子)并选择匹配的帖子格式。
在SLT3中,我做了一个Find Advanced > In Parent Folder
并在中复制了图像自定义post格式代码taxonomy-post_format.php
, languages/twentyfourteen.pot
, inc/widgets.php
并添加了content-product.php
没有运气。
除了默认的标准、旁白、图像、视频、音频、报价、链接和图库之外,我如何添加更多自定义帖子格式,例如产品
From content-product.php:
<?php
/**
* The template for displaying posts in the product post format
*
* @package WordPress
* @subpackage Twenty_Fourteen
* @since Twenty Fourteen 1.0
*/
?>
...
<div class="entry-meta">
<span class="post-format">
<a class="entry-format" href="<?php echo esc_url( get_post_format_link( \'product\' ) ); ?>"><?php echo get_post_format_string( \'product\' ); ?></a>
From widgets.php:
public function widget( $args, $instance ) {
$format = $instance[\'format\'];
switch ( $format ) {
case \'image\':
$format_string = __( \'Images\', \'twentyfourteen\' );
$format_string_more = __( \'More images\', \'twentyfourteen\' );
break;
...
case \'aside\':
default:
$format_string = __( \'Asides\', \'twentyfourteen\' );
$format_string_more = __( \'More asides\', \'twentyfourteen\' );
break;
case \'product\':
default:
$format_string = __( \'Products\', \'twentyfourteen\' );
$format_string_more = __( \'More products\', \'twentyfourteen\' );
break;
}
From twenty fourteen.pot:
#: inc/widgets.php:84 taxonomy-post_format.php:45
msgid "Products"
msgstr ""
#: inc/widgets.php:85
msgid "More products"
msgstr ""
From taxonomy-post_format.php:
<header class="archive-header">
<h1 class="archive-title">
<?php
if ( is_tax( \'post_format\', \'post-format-aside\' ) ) :
_e( \'Asides\', \'twentyfourteen\' );
elseif ( is_tax( \'post_format\', \'post-format-image\' ) ) :
_e( \'Images\', \'twentyfourteen\' );
...
elseif ( is_tax( \'post_format\', \'post-format-product\' ) ) :
_e( \'Products\', \'twentyfourteen\' );
else :
_e( \'Archives\', \'twentyfourteen\' );
endif;
?>
</h1>
</header><!-- .archive-header -->
Most closely related WPSE question here