Javascript Wordpress:在模板中编辑文章的日期、作者和其他内容
我正在使用Generate Press模板,我想自定义帖子页面。我修改了single.php,因此可以更改CSS和php。不过,我希望能够改变作者姓名、日期和内容的出现顺序Javascript Wordpress:在模板中编辑文章的日期、作者和其他内容,javascript,php,html,css,wordpress,Javascript,Php,Html,Css,Wordpress,我正在使用Generate Press模板,我想自定义帖子页面。我修改了single.php,因此可以更改CSS和php。不过,我希望能够改变作者姓名、日期和内容的出现顺序 <main id="mein" <?php generate_main_class(); ?>> <?php do_action('generate_before_main_content'); ?> <?php while ( have_posts() ) :
<main id="mein" <?php generate_main_class(); ?>>
<?php do_action('generate_before_main_content'); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'single' ); ?>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo">Simple collapsible</button>
<div id="demo" class="collapse">
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || '0' != get_comments_number() ) : ?>
<div class="comments-area">
<?php comments_template(); ?>
</div>
<?php endif; ?>
</div>
<?php endwhile; // end of the loop. ?>
<?php do_action('generate_after_main_content'); ?>
</main><!-- #main -->
简单可折叠
我在代码中找不到任何地方可以更改这个。我只能将其作为一个组进行修改。另外,我对PHP还是新手
有什么建议吗?作者、发布日期和时间都是post meta项,可以在
post meta.php
文件中找到
查找第111行附近的函数generate_post_on()
(但可能会有所不同,取决于版本,我刚刚下载了最新版本来查找它,但您的可能会有所不同)
作为补充参考,调用其父函数(generate\u post\u meta
)的代码可以在许多地方找到,但根据您的要求,可以从content single.php
开始
/**
* The template for displaying single posts.
*
* @package GeneratePress
*/
一个简单的方法
<?php get_template_part( 'content', 'single' ); ?>
此代码正在加载content.php的模板部分。因此,在主题文件夹中找到content.php,从content.php复制所有代码并替换上面的代码段
这样你就可以编辑作者,日期和任何你想要的
确保你只需要更换
包含新闻模板中content.php的完整代码的片段