我从Codestag的Themeforest购买了一个名为Shift的WP主题,它是一个非常容易使用和干净的UI。它主要是为博客风格的文章,他们已经创建了预先制作的博客文章风格.
例如," audio“帖子是文本和嵌入的音频文件。“视频”是视频链接和文字,“照片”显然是照片和文本。
我的问题是,这些都是不可定制的,我创建的博客文章类型要么是音频,要么是视频,包括艺术家的照片或相册艺术。我需要添加哪些代码来允许这个预先制作的帖子包含一张照片?(代码如下)
第二个问题是如何将顺序从音频文件、标题、文本更改为标题、图片文本和音频?
这是预先制作的博客样式的代码:"Audio"
<div class="hentry-inner">
<div class="entry-wrapper grids">
<?php get_template_part('content', 'meta'); ?>
<div class="entry-content grid-10 clearfix">
<?php
$embed = get_post_meta(get_the_ID(), '_stag_audio_embed', true);
if(!empty($embed)){
echo do_shortcode(htmlspecialchars_decode($embed));
}else{
stag_audio_player(get_the_ID());
}
?>
<?php if( is_single() ) { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } else { ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'stag'), get_the_title()); ?>"> <?php the_title(); ?></a></h2>
<?php } ?>
<?php
if(!is_singular()){
if(get_the_excerpt() != '') echo "<p>".strip_shortcodes(get_the_excerpt())."</p>";
}else{
the_content(__('Continue Reading', 'stag'));
wp_link_pages(array('before' => '<p><strong>'.__('Pages:', 'stag').'</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
}
?>
</div>
<span class="bottom-accent"></span>
</div>
</div>非常感谢您的帮助!-Peter
发布于 2013-09-28 07:10:55
在这里,我添加了the_post_thumbnail (参见Codex),以显示内容上方的照片:
<div class="hentry-inner">
<div class="entry-wrapper grids">
<?php get_template_part('content', 'meta'); ?>
<div class="entry-content grid-10 clearfix">
<?php
$embed = get_post_meta(get_the_ID(), '_stag_audio_embed', true);
if(!empty($embed)){
echo do_shortcode(htmlspecialchars_decode($embed));
}else{
stag_audio_player(get_the_ID());
}
?>
<?php if( is_single() ) { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } else { ?>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'stag'), get_the_title()); ?>"> <?php the_title(); ?></a></h2>
<?php } ?>
<?php
if(!is_singular()){
if(get_the_excerpt() != '') echo "<p>".strip_shortcodes(get_the_excerpt())."</p>";
}else{
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
the_content(__('Continue Reading', 'stag'));
wp_link_pages(array('before' => '<p><strong>'.__('Pages:', 'stag').'</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
}
?>
</div>
<span class="bottom-accent"></span>
</div>
</div>此模板显示标题、特征图像、内容、音频(按顺序排列):
<div class="hentry-inner">
<div class="entry-wrapper grids">
<?php get_template_part('content', 'meta'); ?>
<div class="entry-content grid-10 clearfix">
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('Permanent Link to %s', 'stag'), get_the_title()); ?>"> <?php the_title(); ?></a></h2>
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail();
}
the_content(__('Continue Reading', 'stag'));
wp_link_pages(array('before' => '<p><strong>'.__('Pages:', 'stag').'</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
$embed = get_post_meta(get_the_ID(), '_stag_audio_embed', true);
if(!empty($embed)){
echo do_shortcode(htmlspecialchars_decode($embed));
}else{
stag_audio_player(get_the_ID());
}
?>
</div>
<span class="bottom-accent"></span>
</div>
</div>WordPress有很好的文档,我建议您深入WordPress码。如果您需要进一步的自定义,您可能应该要求和/或雇用主题作者为您做修改。
https://stackoverflow.com/questions/19038392
复制相似问题