Support

Account

Home Forums Add-ons Flexible Content Field Show all the flexible row labels used on a page? Reply To: Show all the flexible row labels used on a page?

  • @hube2

    I used this to make it work:

    <?php if (have_rows("content_builder")) {
            $i = 0; ?>
        <section class="second-nav" id="second-nav">
            <div class="container">
                <div class="second-nav__menu" id="second-nav__menu">
                    <?php while (have_rows("content_builder")) {
                        the_row();
                        $i++;
                        if ($i != 1):
    
                            $flexField = get_row_layout();
                            $flexField = str_replace("_", "-", $flexField);
                            echo "<a href='#" . $flexField . "'>";
                            if ($flexField == "neighbourhood-overview") {
                                echo "Overview";
                            } elseif ($flexField == "neighbourhood-map") {
                                echo "What's Around";
                            } elseif ($flexField == "neighbourhood-stories") {
                                echo "Tenant Stories";
                            } elseif ($flexField == "show-other-properties") {
                                echo "Our Properties";
                            } elseif ($flexField == "other-neighbourhoods") {
                                echo "Our Neighbourhoods";
                            } else {
                                $flexField = str_replace(
                                    ["_", "-"],
                                    " ",
                                    $flexField,
                                );
                                echo ucwords($flexField);
                            }
                            echo "</a>";
                            ?>
    
        <?php
                        endif;
                    } 
    }
    }?>