Home › Forums › General Issues › ACF usage with Genesis Framework › Reply To: ACF usage with Genesis Framework
Hi Ally,
Ok so it sounds like you need to edit your posts single.php file. Also, note that Genesis requires it’s own hooks.
Any changes you made before like the plugins.php and to your functions.php etc…remove or save somewhere else, let’s start fresh.
Next, copy to your child theme the file “single.php” and add the following before “genesis();” these are the hooks that you can turn on or off depending on your theme design, otherwise you will get just the content and no header, footer etc…:
//* Force full width content layout
add_filter( 'genesis_pre_get_option_site_layout','__genesis_return_full_width_content' );
//* Removes the breadcrumb navigation
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
//* Removes the post info function
remove_action( 'genesis_entry_header', 'genesis_post_info', 5 );
//* Removes the author box on single posts
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
//* Removes the post meta function
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_loop', 'genesis_do_loop' );
Now we have to add the genesis loop, where I say “anyname” change to a name that makes sense, so now add the following:
//======================================================================
// BEGIN ACF CONTENT
//======================================================================
add_action( 'genesis_loop', 'anyname_loop' );
function anyname_loop() { ?>
<article itemtype="http://schema.org/company" itemscope="itemscope" class="post-<?php print $pageid; ?> page type-page status-publish entry">
<div class="entry-content" itemprop="text">
<div class="co-wrapper">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<div class="co-title">
<h1><?php the_title(); ?></h1>
</div>
<strong>Add your ACF content in here along with any html you want.</strong>
</div>
</div>
</article>
This should get you started with where to drop your acf code and your html.
Lastly, if the site is live, I suggest testing this on a staging site or locally.
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.