我想我可能做错了什么。但是,首先,我在我的WordPress上用新的Facebook插件发布了我的Facebook页面。事情进行得不是很顺利:没有文本摘录,有时无法显示特色图像。所以我在插件中禁用了它,并使用了API。它正在张贴,但现在摘录带有html标签,例如:
<p> this is a blog post</p>
<p> <em> this is the post content</em> </p>
为什么会这样呢?
我需要显示不同长度的节选,所以我用
function custom_excerpt($length) {
get_the_content();
... clean up and trim
return $excerpt;
}
但是,我希望检测是否输入了一个手动摘录,以便使用它而不是自定义的摘录。有办法这样做吗?
我试着用
$wp_excerpt = get_the_excerpt();
但这会返回手动摘录,如果手动摘录为空,它将自动生成55个字符的摘录,这没有帮助,因为它总是“真”(不能检查是否为空)。
采用这种方式的原因是,我在一个页面上有多个节选(不同的长度),如果需要的长度比Wo
嗨,我是wordpress的新手,我想在我的页面中显示一个节选,使用the_excerpt函数来显示p标记中的所有文本内容,而不是在h1 & em标记中显示这些内容。
以下是我的wordpress页面内容的样子:
<h1>Lorem ipsum dolor sit amet</h1>
<em>Aug. 12, 2014</em>
<p>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore.</p>
下面是我展示节选的方式:
我想在特定部分显示其他子页面,所以我找到了这段代码。 <?php
//GET CHILD PAGES IF THERE ARE ANY
$children = get_pages('child_of='.$post->ID);
//GET PARENT PAGE IF THERE IS ONE
$parent = $post->post_parent;
//DO WE HAVE SIBLINGS?
$siblings = get_pages('child_of='.$parent);
if( count($children) !=