Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #820902

    I run a site for a non-profit which has lots of volunteers who are creating/editing content. I would like to simplify things for them as frequent mistakes happen.

    We only use the default editor for Posts. So for Posts, I would like to remove (hide) the Advance Layout Editor button so there is not even the option for volunteers to make that mistake.

    For Pages and Portfolio Items, we only use the Advanced Layout Editor. With these, I would like to have a new Page or Portfolio Item default to the Advanced Layout Editor and not show the button to switch to Default Editor.

    From this thread I found the following function that makes the Advanced Editor the default:

    // make avia default on new posts
    // use #postdivrich_wrap for editor only, #post-body for (pretty much) everything
    // see https://kriesi.at/support/topic/always-open-advanced-layout-builder/#post-452117
    add_action('admin_head-post-new.php', 'trigger_alb_on_load');
    function trigger_alb_on_load(){
    	echo '<style>#post-body { display: none; }</style>';
    	?>
    	<script>		
    		(function($){
    			$(window).load(function() {
    				$("#avia-builder-button").trigger('click');
    				$("#post-body").css('display', 'inherit');
    			});
    		})(jQuery);
    	</script>
    	<?php
    }

    This works, except I would like it to only work for Pages and Portfolio Items and leave Posts as the regular default editor. Then I need a way to hide the buttons so users cannot switch them. Any help appreciated.

    #821678

    Hey draig,

    You can add this code in the wp-content/themes/enfold/framework/css/avia_admin.css
    file at the bottom to hide the button:

    
    .post-type-post #avia-builder-button { display:none; }
    

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #821809

    Thanks for the CSS!

    How would I change the function above so that it only made the Advanced Layout Editor default for Pages and Portfolio-Items but not for Posts?

    #822206

    Hi,

    Please try

    .post-type-portfolio #avia-builder-button { display:none; }

    and let us know if it works for you!

    Best regards,
    Basilis

    #822234

    Pardon… I must not have been clear. I want to make the Advanced Layout Editor be default for Pages but not for Posts.

    The function above makes all post types (Post, Pages, Portfolio Items) have the Advanced Layout Editor be active by default. How would I adjust that function to do what I want?
    Thanks

    #822696

    Hi draig,

    You have to check what kind of page that is in a conditional statement before adding the script.
    https://codex.wordpress.org/Conditional_Tags

    Best regards,
    Victoria

    #822766

    Hi Victoria,

    Thanks for the reply. It is beyond my skill level to know how to edit that function. I thought it might be easy enough that one of you more skilled folks could make a quick edit. Anyway, I understand it is getting beyond the support area.
    Cheers

    #828539

    My client is still asking for having Pages default to Advanced Layout Editor. Please let me know if you can or cannot help me make this function apply only to Pages (not posts or portfolio items). Then I can just use the css you gave me to hide the button which will reduce errors by volunteers. Thanks

    // make avia default on new posts
    // use #postdivrich_wrap for editor only, #post-body for (pretty much) everything
    // see https://kriesi.at/support/topic/always-open-advanced-layout-builder/#post-452117
    add_action('admin_head-post-new.php', 'trigger_alb_on_load');
    function trigger_alb_on_load(){
    	echo '<style>#post-body { display: none; }</style>';
    	?>
    	<script>		
    		(function($){
    			$(window).load(function() {
    				$("#avia-builder-button").trigger('click');
    				$("#post-body").css('display', 'inherit');
    			});
    		})(jQuery);
    	</script>
    	<?php
    }
    #830885

    Hi,

    Please use the get_current_screen function.

    // make avia default on new posts
    // use #postdivrich_wrap for editor only, #post-body for (pretty much) everything
    // see https://kriesi.at/support/topic/always-open-advanced-layout-builder/#post-452117
    add_action('admin_head-post-new.php', 'trigger_alb_on_load');
    function trigger_alb_on_load(){
    	$screen = get_current_screen();
    	if ( $screen->id != 'page' ) return;
    	echo '<style>#post-body { display: none; }</style>';
    	?>
    	<script>
    		(function($){
    			$(window).load(function() {
    				$("#avia-builder-button").trigger('click');
    				$("#post-body").css('display', 'inherit');
    			});
    		})(jQuery);
    	</script>
    	<?php
    }
    

    Best regards,
    Ismael

    #834519

    Hi Ismael,

    Thank you! Your effort is appreciated! This does exactly what I asked for…

    #834660

    We’re glad that the team was able to help you! We’ll close this topic now. For any other questions or issues, feel free to post them here on the forum and we will do our best to assist you.

    Thank you for using Enfold.
    Cheers!
    Sarah

    And if there are features that you wish Enfold had, you can request them and vote the requested ones here – https://kriesi.at/support/enfold-feature-requests/

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Customizing Advanced Layout Editor defaults’ is closed to new replies.