- This topic has 6 replies, 2 voices, and was last updated 3 years, 9 months ago by Tom.
July 19, 2017 at 6:55 pm #351968Beau
I have a food menu I built using ACF Pro and it works great when the menu page that is using the template doesn’t have Sections turned on for the remaining content. When it does, all of the data in the ACF disappears. How can I dig that content out from the Sections and add it to the template?
BeauGeneratePress 1.3.48GP Premium 1.3.1July 19, 2017 at 11:46 pm #352059TomLead DeveloperLead DeveloperJuly 20, 2017 at 3:04 am #352121Beau
Yes exactly – pretty bare bones template. Is there other code that brings in the content from the sections that I’m missing?July 20, 2017 at 12:59 pm #352429TomLead DeveloperLead Developer
Sections itself using a custom page template, so I don’t think you’ll be able to use the two together.
However, you should be able to build your own sections inside your page template without using the Sections add-on.July 20, 2017 at 6:27 pm #352522Beau
Ya I was actually trying to do that last night, but I can’t seem to get my images to stretch full width (like what the sections do) – the sides of the images keep hitting the margins.
Here’s what I have for the template:
<?php /* Template Name: Menu */ get_header(); ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php // Start the loop. while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> </header><!-- .entry-header --> <div class="entry-content" style="padding:0;"> <?php the_content(); ?> <h1>Our Menu</h1> <?php if ( have_rows('menu_sections') ): while ( have_rows('menu_sections') ): the_row(); ?> <h2 class="section-title"><?php the_sub_field('section_title'); ?></h2> <span class="section-description"><?php the_sub_field('section_description'); ?></span><hr> <?php if ( have_rows('section_items') ): ?> <table class="menu"> <?php while ( have_rows('section_items') ): the_row(); ?> <tr> <td width="60%" valign="top"><span class="dish-title"><?php the_sub_field('dish_name'); ?></span><br> <span class="dish-description"><?php the_sub_field('dish_description'); ?></span></td> <td width="40%" valign="top"><div class="dish-price"><?php the_sub_field('dish_price'); ?></div></td> </tr> <tr> <td colspan="2" valign="top"><br><br></td> </tr> <?php endwhile; ?> </table> <?php endif; ?> <?php endwhile; endif; ?> </div><!-- .entry-content --> </article><!-- #post-## --> <?php endwhile; // End the loop. ?> * Consuming raw or undercooked foods may increase your risk of food-borne illness </main><!-- .site-main --> </div><!-- .content-area --> </div> <?php get_footer(); ?>July 20, 2017 at 6:40 pm #352525Beau
Never mind I got it! I added a simple if/then check in header.php to see if it was the Menu page and if it was, added in the full width image.
Thanks again for everything! F’ing love working w/ GP.July 20, 2017 at 7:38 pm #352537
- You must be logged in to reply to this topic.