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();';
endif;
?>
// 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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.