I need to display some extra information on the blog archive page, but can't code it in because other people must be able to edit the information.
I added some custom fields on this page, but can't display them on the actual page. Any way to solve this?
My code:
<div class="save_the_date">
<?php
if( have_rows('actiedagen') ):
while ( have_rows('actiedagen') ) : the_row();
the_sub_field('actiedagen_titel');
the_sub_field('actiedagen_datum');
the_sub_field('actiedagen_locatie');
endwhile;
else :
endif;
?>
</div>
You can add an options page for editing those fields:
if (function_exists('acf_add_options_page')) {
acf_add_options_page(array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-general-settings',
'capability' => 'edit_posts',
'redirect' => false
));
}
Then display this field group on this options page.
As to showing the values, you would need to add the second parameter "option" like this:
<?php
if( have_rows('actiedagen', 'option') ):
while ( have_rows('actiedagen', 'option') ) : the_row();
the_sub_field('actiedagen_titel'); // no need to add option here
the_sub_field('actiedagen_datum');
the_sub_field('actiedagen_locatie');
endwhile;
else :
endif;
?>