如何在 Marketify 单曲中将特色图片移动到标题下方 post
How to move the featured image below the title in Marketify single post
我正在尝试将 post 的特色图片移动到 Marketify 主题中的 post 标题下方,但我似乎无法在代码中找到它。
谁能帮我找到 post 的特色图片的代码?如何将其移至 post 标题下方?
首先,为您的 WordPress 主题创建一个 Child Theme。
然后在“/wp-content/themes/[theme-name] 中查找,您应该在其中找到名为 'single.php' 的文件。将其复制到您的子主题中,注意确保复制相同的目录层次结构。 'single.php' 通常是默认博客 Post 模板的名称。
使用诸如 Notepad++ 之类的程序打开您保存在子主题中的 'single.php' 文件(记事本也可以,但不那么容易看)。
您应该看到如下内容:
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}?>
<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1> //This is the title of your Blog Post.
<div class="entry">
<?php the_content(); ?> //This is the content of your Blog Post.
</div>
<?php endwhile; ?>
<?php endif; ?>
编码会略有不同,但您要做的是突出显示:
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}?>
然后将此编码移至 <h1><?php the_title(); ?></h1>
下面。您需要仔细研究您需要它的确切位置,但我希望这可以帮助您入门。
我建议您在子主题中执行此操作的原因是,当主题开发人员推出更新时,它将删除您在父文件中所做的任何修改。
祝你好运!
感谢您的评论。我假设它也与您编写的代码类似,但标题和特色图片隐藏在 "do_action( 'marketify_entry_before' );".
get_header(); ?>
<?php do_action( 'marketify_entry_before' ); ?>
<div class="container">
<div id="content" class="site-content row">
<div role="main" id="primary" class="col-xs-12 col-md-8 <?php echo ! is_active_sidebar( 'sidebar-1' ) ? 'col-md-offset-2' : '' ?>">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
None 少了,其他有同样问题的人;我想出了如何像这样在 css 中隐藏此部分...
.single .header-outer.has-image .page-header {
display: none;
}
然后可以使用标准的 Wordpress 功能使标题和特色图片出现在我想要的位置。
谢谢:)
汤姆
我正在尝试将 post 的特色图片移动到 Marketify 主题中的 post 标题下方,但我似乎无法在代码中找到它。
谁能帮我找到 post 的特色图片的代码?如何将其移至 post 标题下方?
首先,为您的 WordPress 主题创建一个 Child Theme。
然后在“/wp-content/themes/[theme-name] 中查找,您应该在其中找到名为 'single.php' 的文件。将其复制到您的子主题中,注意确保复制相同的目录层次结构。 'single.php' 通常是默认博客 Post 模板的名称。
使用诸如 Notepad++ 之类的程序打开您保存在子主题中的 'single.php' 文件(记事本也可以,但不那么容易看)。
您应该看到如下内容:
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}?>
<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
<h1><?php the_title(); ?></h1> //This is the title of your Blog Post.
<div class="entry">
<?php the_content(); ?> //This is the content of your Blog Post.
</div>
<?php endwhile; ?>
<?php endif; ?>
编码会略有不同,但您要做的是突出显示:
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}?>
然后将此编码移至 <h1><?php the_title(); ?></h1>
下面。您需要仔细研究您需要它的确切位置,但我希望这可以帮助您入门。
我建议您在子主题中执行此操作的原因是,当主题开发人员推出更新时,它将删除您在父文件中所做的任何修改。
祝你好运!
感谢您的评论。我假设它也与您编写的代码类似,但标题和特色图片隐藏在 "do_action( 'marketify_entry_before' );".
get_header(); ?>
<?php do_action( 'marketify_entry_before' ); ?>
<div class="container">
<div id="content" class="site-content row">
<div role="main" id="primary" class="col-xs-12 col-md-8 <?php echo ! is_active_sidebar( 'sidebar-1' ) ? 'col-md-offset-2' : '' ?>">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
None 少了,其他有同样问题的人;我想出了如何像这样在 css 中隐藏此部分...
.single .header-outer.has-image .page-header {
display: none;
}
然后可以使用标准的 Wordpress 功能使标题和特色图片出现在我想要的位置。
谢谢:)
汤姆