Add php code in theme file to be shown in post

Hi, i use Frontier theme https://wordpress.org/themes/frontier/
i create some fields via ACF plugin and i need to place code to display that fields in post, can you check theme file and tell me which file i should edit and where to add code, i am interested in two options, after title and before content, and after post content. please help me, thanks.

  • Kasia Swiderska

    Hello Nikola,

    In this theme if you want to change posts, you need to modify loop-single.php template file.
    Post title is in line 35

    <h1 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>

    post content is from line 72 till 102

    <div class="entry-content cf">
    	<?php do_action('frontier_before_single_post_content'); ?>
    
    	<?php if ( is_active_sidebar('widgets_before_post_content') ) : ?><div id="widgets-wrap-before-post-content" class="cf"><?php dynamic_sidebar('widgets_before_post_content'); ?></div><?php endif; ?>
    
    	<?php the_content(); ?>
    
    	<?php if ( is_active_sidebar('widgets_after_post_content') ) : ?><div id="widgets-wrap-after-post-content" class="cf"><?php dynamic_sidebar('widgets_after_post_content'); ?></div><?php endif; ?>
    
    	<?php if ( is_attachment() && wp_attachment_is_image() ) : ?>
    		<div class="attachment-nav cf">
    			<?php $nav_image_size = apply_filters( 'frontier_prev_next_image_size', 0 ); ?>
    			<div class="link-prev"><?php previous_image_link( $nav_image_size, __('← Previous Image', 'frontier') ); ?></div>
    			<div class="link-next"><?php next_image_link( $nav_image_size, __('Next Image →', 'frontier') ); ?></div>
    		</div>
    	<?php endif; ?>
    
    	<?php wp_link_pages( array(
    		'before'           => '<div class="page-nav">' . __('<span>Pages</span>', 'frontier'),
    		'after'            => '</div>',
    		'link_before'      => '<span>',
    		'link_after'       => '</span>',
    		'next_or_number'   => 'number',
    		'nextpagelink'     => __('Next page', 'frontier'),
    		'previouspagelink' => __('Previous page', 'frontier'),
    		'pagelink'         => '%',
    		'echo'             => 1 ) );
    	?>
    
    	<?php do_action('frontier_after_single_post_content'); ?>
    </div>

    so you put your code before or after that lines.

    kind regards,
    Kasia

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.