Home › Forums › General Issues › ACF in attachment-single.php › Reply To: ACF in attachment-single.php
1) what are you puting in the chapo field.
<p>WYSIWYG content from get field</p>
2) what are you putting in the content editor
<audio><!-- attachment audio stuff... --></audio>
(this really is the media file)
3) where / how is the attachment being added
From the media library (wp-admin/media-new.php)
4) whats the code in your php file
page.php
<?php
get_header();
while (have_posts())
{
the_post();
if ( get_post_type() == 'attachment' )
{
get_template_part( 'attachment', 'single' );
}
else
{
get_template_part( 'content', 'page' );
}
}
get_footer();
attachment-single.php
<div class="chapo">
<?php
if ( get_field( 'chapo' ) )
{ ?>
<?php echo get_field( 'chapo' ); ?>
<?php
} ?>
</div>
<div class="content">
<?php the_content(); ?>
</div>
5) what should be the desired output?
<div class="chapo"><p>WYSIWYG content from get field</p></div>
<div class="content"><audio><!-- attachment audio stuff... --></audio></div>
6. What actually appears?
<div class="chapo"><audio><!-- attachment audio stuff... --></audio><p>WYSIWYG content from get field</p></div>
<div class="content"><audio><!-- attachment audio stuff... --></audio></div>
Note: This happens with any media file, not just audio.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.