Support

Account

Home Forums Add-ons Flexible Content Field Other Page Flexable Content

Solved

Other Page Flexable Content

  • 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;?>
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Other Page Flexable Content’ is closed to new replies.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.