• Resolved Dennis Bareis

    (@dbareis)


    I have created 2 field groups, as far as I can see there is no significant difference between them yet one always begins compressed and the other expanded. I’d like them both expanded to start with (or at least swap the expanded one..).

Viewing 5 replies - 1 through 5 (of 5 total)
  • You might try dumping (i.e., “export[ing]” the POD to a JSON file and examine and compare those sub-groups in the JSON code. I suspect one sub-group has a switch set causing it to display expanded. The JSON code would show this difference.

    Thread Starter Dennis Bareis

    (@dbareis)

    I had a look at json_encode() which I’ll try next time, I’ve been mainly using “printr()”.

    I changed both of them to “advanced” for “Meta Box Context” and that seems to have done the trick.

    Thread Starter Dennis Bareis

    (@dbareis)

    That didn’t seem to work after all. It is not consistent or it might remember (sometimes whether I expanded it).

    Plugin Support Paul Clark

    (@pdclark)

    @dbareis As far as I know, there is no setting for this. One would need to add JavaScript to force the default open and closed states. For example, for meta box groups titled “Group 1” and “Group 2”:

    <?php
    
    add_action( 'admin_footer-post.php', 'modify_meta_group_visibility', 1000 );
    add_action( 'admin_footer-post-new.php', 'modify_meta_group_visibility', 1000 );
    
    function modify_meta_group_visibility(){
    	?>
    <script>
    	jQuery(document).ready(function($){
    		$('#pods-meta-group-1').removeClass('closed');
    		$('#pods-meta-group-2').addClass('closed');
    	});
    </script>
    	<?php
    }
    Thread Starter Dennis Bareis

    (@dbareis)

    @pdclark

    Thanks for the response Is “jQuery” an API that is always available?

    I’d want them both open so I would use “.removeClass(‘closed’)” and the “.addClass(‘open’)”

    I’m not sure why you have both meta’s mentioned and use close on both on different methods…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Field Groups (expanded vs Collapsed)’ is closed to new replies.