• Resolved henrik.arvedsen

    (@henrikarvedsen)


    I have recently purchased the premium version of the Oceanic template, which is very beautiful. ??

    I need to know how to insert some Advanced custom fields attached to a custom post type in the template.

    I have created a child theme and copied the file single.php to the child directory and renamed it to single-posttypename.php and there added the field code <p>Label: <?php the_field('fieldname'); ?></p> just before <?php get_template_part( 'content', 'single' ); ?>. The field appears in the frontend then, but before the post title. Moving the code below just makes the field show up before the comments which is too far down.

    Adding the code to the file content-single.php just before <?php the_content(); ?> makes the field show up in the right place in the frontend. But the problem is that the field not just show up in the custom post type. It appears now in the regular posttype post also.

    How can I solve this issue?

    All the best
    Henrik

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to insert advanced custom fields in template?’ is closed to new replies.