Home Forums Add-ons Flexible Content Field Hide Layout Option in Flexible Content Reply To: Hide Layout Option in Flexible Content

  • Thanks petercarsater,

    This is just what i needed!

    The code you have shown is all a bit advanced for me, trying to understand it. I kind of want to be a bit freestyle in what i hide and don’t hide so i bodged your code to echo the page-id to the admin’s body class so i can be really detailed with what pages see what:

     if ($post->post_type == "page") : // set 'page' for page postypes
                        echo 'var $template_name = "page";';
                    else :
                        // Just get the template name
                        echo 'var $template_name = $("#page_template").val();';
                    // Add classes to body
                    window.UpdateACFView = function($template_name) {
                        if ($template_name == "page") {
                            $('body').addClass('<?php global $post; echo "pageid-".$post->ID; ?>');

    Can you let me know if this is the best practice to achieve this? Seems to work though.