admin管理员组文章数量:1334656
Before describing the problem, let me first tell that I have already searched on google, also read the ACF documentation, support, even asked on their support forum but it's hard to get any kind of answer there.
So the thing is I have this wysiwyg on a custom post type I made where I have an item description, I really don't want to use the wp default editor because I designed a structure on the post to be more user friendly.
The problem comes when I add the tag to the field, it will not work as the_content('Read More') for example, I have tried to find out but failed. I'm using the
<?php
global $more
$more = 0;
?>
but then if I want to use like for example:
<?php the_field('the_field_name','Read More')?>
it will not show the More tag.
What can I do to display it?
Before describing the problem, let me first tell that I have already searched on google, also read the ACF documentation, support, even asked on their support forum but it's hard to get any kind of answer there.
So the thing is I have this wysiwyg on a custom post type I made where I have an item description, I really don't want to use the wp default editor because I designed a structure on the post to be more user friendly.
The problem comes when I add the tag to the field, it will not work as the_content('Read More') for example, I have tried to find out but failed. I'm using the
<?php
global $more
$more = 0;
?>
but then if I want to use like for example:
<?php the_field('the_field_name','Read More')?>
it will not show the More tag.
What can I do to display it?
Share Improve this question edited Oct 31, 2013 at 9:20 brasofilo 22.1k8 gold badges70 silver badges264 bronze badges asked Apr 26, 2012 at 15:17 JaypeeJaypee 3371 gold badge7 silver badges19 bronze badges 1 |2 Answers
Reset to default 2Simply go and apply the default filter:
// You´ll likely need a function that doesn´t echo/print the output to get this working
// without an error
echo apply_filters( 'the_excerpt', get_field( 'YOUR_FIELD_NAME', get_the_ID() ) );
I know this is an old question but if you are looking for some flexibility when handling the content and the "read more", you can also use get_extended
.
get_extended( get_field('the_field_name') );
This will return an array with the content separated in main
, extended
and more_text
.
Read more here:
https://developer.wordpress/reference/functions/get_extended/
本文标签: Advanced Custom Fields WYSIWYG More tag
版权声明:本文标题:Advanced Custom Fields WYSIWYG More tag 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742378156a2463581.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
the_field
orget_field
can have the second parameter of "Read More" ? - advancedcustomfields/docs/functions/get_field – brasofilo Commented Dec 2, 2012 at 0:54