This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How to Use Page Revisions with Layout Builder

  • Creator
    Topic
  • #20485
    Brett
    Participant

    I am just curious, does the layout builder work with page revisions so you can go back to a previously saved version of the page?

Viewing 12 replies - 16 through 27 (of 27 total)
  • Author
    Replies
  • #25633
    Jason Bobich
    Keymaster

    Is there a way to simply remove the DELETE (and maybe the DUPLICATE) link in the builder elements (at least for non-admin users)?

    You’d just enqueue a stylesheet in the admin, and hide whatever elements in the layout builder you want with display: none !important.

    https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

    #25636
    askwpgirl
    Participant

    Sweet!!!!! Will do that. Of course there’s a stylesheet. Lol. 🙂

    #25637
    kennethfeldman
    Participant

    I followed the code on the link, https://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts

    but it only adds the new stylesheet to the parent theme directory.

    How do I enqueue to the child theme?

    #25638
    askwpgirl
    Participant

    Kenneth, here’s the code:

    function load_custom_wp_admin_style() {
            wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/assets/css/admin-style.css', false, '1.0.0' );
            wp_enqueue_style( 'custom_wp_admin_css' );
    }
    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );
    

    I usually put my custom CSS files in a folder called “assets” in a folder called “css” in my child theme folder.

    #25639
    askwpgirl
    Participant

    Here’s the selector to add to the admin-style.css file you’ve created:

    #optionsframework .widget-footer a.delete-element { display: none; }

    #25640
    kennethfeldman
    Participant

    Tx. Got that one — now looking to isolate the X for the Section Delete tabs.

    #25641
    askwpgirl
    Participant

    I created a Google group and some other resources for Jump Start here. I’m trying to collect these helpful code snippets.

    Code snippets and resources:

    http://wpcourses.askwpgirl.com/index.php?/register/UWmp49

    Google Group Jump Start user group:

    https://groups.google.com/d/forum/jumpstart

    Pinterest board and add your work, go here:

    https://www.pinterest.com/askwpgirl/wp-jump-start-wordpress-framework-showcase/

    #25642
    kennethfeldman
    Participant

    This does them both; the x-section delete, and the small red footer delete link:

    #optionsframework a.delete-element,
    #optionsframework a.delete-section {
    display: none !important;
    }

    #25644
    kennethfeldman
    Participant

    Now I feel a little better about clients rooting around in the template builder area.

    Thanks Jason and askwpgirl!

    #25645
    askwpgirl
    Participant

    I didn’t need the !important, but I did give my add action a priority of 25:

    function load_custom_wp_admin_style() {
            wp_register_style( 'custom_wp_admin_css', get_stylesheet_directory_uri() . '/assets/css/admin-style.css', false, '1.0.0' );
            wp_enqueue_style( 'custom_wp_admin_css' );
    }
    add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style', 25 );
    #25646
    kennethfeldman
    Participant

    Great! I’ll do that too (priority 25).

    NOTE: I just found another (red text) DELETE link. (And I suppose there are more in elements that I just haven’t used yet…)

    This one’s in a TABS element inside of a COLUMNS element.

    It’s: #builder_blvd #optionsframework a.delete-block

    This one needs the #builder_blvd ID in front of the #optionsframework in order to override another display:block style coming from elsewhere.

    So together now (so far) it’s:

    #optionsframework a.delete-element,
    #optionsframework a.delete-section,
    #builder_blvd #optionsframework a.delete-block {
    display: none;
    }

    #25758
    kennethfeldman
    Participant

    Adding to this topic:

    As admin, I WANT the DELETE buttons.

    But I don’t want other user levels to have them.

    So I’ve added a function which adds a user-level-class to the body tag of the admin pages.

    Then using CSS, I can “turn off” the DELETE links for EDITORS, while leaving them in place for me, the ADMIN.

    /**
     * Add class to admin <body>
     */
    function my_admin_body_class( $class ) {
    
        if ( is_user_logged_in() ) {
            $user = new WP_User( get_current_user_id() );
            $class .= ' ' . array_shift( $user->roles );
        }
    
        return $class;
    }
    add_filter('admin_body_class', 'my_admin_body_class');

    Then the CSS:

    body.editor #optionsframework a.delete-element,
    body.editor #optionsframework a.delete-section,
    body.editor #builder_blvd #optionsframework a.delete-block {
    display: none;
    }
Viewing 12 replies - 16 through 27 (of 27 total)

You must be logged in to reply to this topic.