我想在每篇文章的开头添加一些文本或图像(在给定的文章布局中)。
在内容开始之前,我已经找到了许多方法来实现这一点(当然,我可以通过添加上面的文本来实现<?php the_content(); ?>
).
但我想在内容的开头插入它--在同一行,比如:
这里是一些自定义文本,这里开始为帖子输入的内容。
有什么想法吗,社区?
我想在每篇文章的开头添加一些文本或图像(在给定的文章布局中)。
在内容开始之前,我已经找到了许多方法来实现这一点(当然,我可以通过添加上面的文本来实现<?php the_content(); ?>
).
但我想在内容的开头插入它--在同一行,比如:
这里是一些自定义文本,这里开始为帖子输入的内容。
有什么想法吗,社区?
您可以尝试以下操作:
! is_admin() && add_filter( \'the_content\', function( $content )
{
if( in_the_loop() ) // <-- Target the main loop
{
$prepend = \'HERE IS SOME CUSTOM TEXT\'; // <-- Edit your text here
$content = $prepend . $content;
}
return $content;
}, 9 ); // <-- Choose some priority < 10
在完成内容之前,我们选择优先级wpautop
.I\'m wanting to use the MailChimp RSS to Email Campaign mechanism to send a weekly email of posts to list subscribers. This works just fine in standard use, but the twist is that I don\'t want MailChimp to only pick up new posts. Each week I want it to in