自定义 WordPress 摘录未添加
标签
对于我正在使用的自定义摘录功能,我遇到了一些棘手的情况。
这里是具有自定义摘录功能的 Pastebin 的链接: http://pastebin.com/gK0AWQbt< /a>
这是使用该功能的博客索引: http://club16.abcguide.com/blog/
另外,我在这里使用的代码是:
这是单页上的帖子,格式正确:http: //club16.abcguide.com/newsletters/jan-2012/
本质上我正在使用的摘录函数不会生成我的
标签围绕元素,我不确定如何修改该函数以使其有效地执行此操作。
另外,如果我可以更好地控制摘录何时结束(甚至可能是每个帖子?如果我能让它识别一个特定的类别并在那里切入......)那就太棒了。
但专注于手头的任务,我迫切需要一个解决方案!
I'm in a bit of a sticky situation with a custom excerpt function I'm using.
Here's a link to the Pastebin with the Custom Excerpt Function: http://pastebin.com/gK0AWQbt
This is the blog index using the function: http://club16.abcguide.com/blog/
Also, the code I'm using here is: <?php echo excerpt(300); ?>
And here's the post on the single page, with proper formatting: http://club16.abcguide.com/newsletters/jan-2012/
Essentially the excerpt function I'm using isn't generating my <p>
tags around elements, I'm not sure how I can modify the function to have it do this efficiently.
Also, if I can have more control of when the excerpt ends (maybe even per post? If I could make it identify a specific class and cut there..) that would be amazing.
But focusing on the task at hand, I'm in dire need of a solution!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,摘录显示前 55 个字符,并删除所有 html 标签。如果您想增加摘录函数的长度,那么您可以使用如下所示的过滤器,只需将此代码片段添加到主题的functions.php文件中,并将函数调用包装在index.php文件中的ap标签内。
在 p 标记内的 index.php 文件中使用 the_excerpt() 而不是 the_excerpt(300)。
By default excerpt shows first 55 characters and it strips out all html tags. If you want to increase the length of the excerpt function then you can us a filter like one given bellow, just add this code snippet in your functions.php file of your theme and wrap the function call inside a p tag in the index.php file.
Use the_excerpt() instead of the_excerpt(300) in your index.php file inside the p tag.