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
  • 1 ¿ Where did you got that the_field or get_field can have the second parameter of "Read More" ? - advancedcustomfields/docs/functions/get_field – brasofilo Commented Dec 2, 2012 at 0:54
Add a comment  | 

2 Answers 2

Reset to default 2

Simply 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