I don't seem to understand. All the other post type data is being searched by the default wordpress search but when I try to search the Custom Post type data, it just gives me the page title and not the content. What is this issue.
Here is my search.php code
<div class="contentarea">
<div id="content" class="content_right">
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="posts">
<article>
<h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
<p><?php the_content();?></p>
<a href="<?php the_permalink();?>">Read More</a>
</article>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div><!-- content -->
</div><!-- contentarea -->
I don't seem to understand. All the other post type data is being searched by the default wordpress search but when I try to search the Custom Post type data, it just gives me the page title and not the content. What is this issue.
Here is my search.php code
<div class="contentarea">
<div id="content" class="content_right">
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="posts">
<article>
<h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
<p><?php the_content();?></p>
<a href="<?php the_permalink();?>">Read More</a>
</article>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div><!-- content -->
</div><!-- contentarea -->
Share
Improve this question
asked Aug 4, 2017 at 15:21
Jon_SnowJon_Snow
183 bronze badges
5
|
1 Answer
Reset to default 0Advanced Custom Fields does not automatically output the fields you add in the_content()
. You need to use ACF's template functions. Refer to the documentation for more.
Based on your comment, yours will look something like:
<div class="contentarea">
<div id="content" class="content_right">
<?php if ( have_posts() ) :
while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="posts">
<article>
<h4><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h4>
<p><?php the_content();?></p>
<?php while ( have_rows( 'details' ) ) : the_row(); ?>
<?php the_sub_field( 'name' ); ?><br>
<?php the_sub_field( 'description' ); ?>
<?php endwhile; ?>
<a href="<?php the_permalink();?>">Read More</a>
</article>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div><!-- content -->
</div><!-- contentarea -->
the_content()
. – WebElaine Commented Aug 4, 2017 at 15:25