Hi I trying to use other page for flexible content basically i using flexible content as a sidebar on a site and wanted a fallback in case they haven’t added any content so it falls back to home page content
so i want if has flexible content then use the page id unless use the home page id
any ideas if this can be achieved i played about with some statements but returned nothing
thanks matt
have you tried
if (get_field('flex-field-name')) {
page id
} else {
homepage ID
}
?
that will check if there’s something in the flex field first off, and if there isn’t it’ll fall back to the homepage code
Yeah thanks worked a treat code is
<? if (get_field('sidebar')):?>
<?php $other_page = $post->ID;?>
<?php else:?>
<?php $other_page = 5; ?>
<?php endif;?>