Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1406333

    Hi,

    I would like the ALB enabled for PAGES (not POSTS) by default when I create a new PAGE.

    In older theme versions this code by @Mike worked fine:
    https://kriesi.at/support/topic/bulk-enable-advanced-layout-builder-on-pages/#post-1102304

    With ENFOLD 5.5. not: when I create a new page the ALB is not enabled by default.
    My themesettings are set to “Classic Editor” by the way.

    What is the right code snippet please, so that the ALB is enabled FOR PAGES (NOT for POSTS) BY DEFAULT please?

    Thank you.

    #1406365

    Hey BeeCee,
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function trigger_alb_on_load_for_page(){
    	?>
    	<script>
    	window.addEventListener('DOMContentLoaded', function() {
    	(function($){
    		if ($('body.wp-admin.post-new-php.post-type-page').length > 0){
    			setTimeout(function(){
    			$("#avia-builder-button").trigger('click');
    			},300);
    		}
    	})(jQuery);
        });
    	</script>
    	<?php
    }
    add_action('admin_head-post-new.php', 'trigger_alb_on_load_for_page');

    Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
    In my test a timeout of 300 ms (less than half a second) is required for the ALB button to be available, so if this doesn’t work for you try increasing the “300” to a higher number.
    Also ensure you are not deferring jQuery with a caching plugin or in theme options, such as Enfold Theme Options ▸ Performance ▸ Load jQuery in your footer

    Best regards,
    Mike

    #1406380

    It works perfect now with your code snippet!
    Thank you very much!!

    #1406381

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Activate ALB for pages by default’ is closed to new replies.