• Resolved WPwebbouw

    (@wpwebbouw)


    Is it possible to disable the layouts feature for end users? I am using OptionTree to build a theme and I find the layouts feature confusing for end users. Moreover it doesn’t match with the concept of the custom CSS, as CSS from different layouts is all stored in the same dynamic.css file, while the options are saved in the database. So I want to disable this whole feature. I’d prefer to do this the ‘neat’ way with a filter. If that’s not available, do I have to alter the core code?

    tia Erik

    https://www.ads-software.com/plugins/option-tree/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Derek Herman

    (@valendesigns)

    You can hide the layouts section at the top of the theme options page by adding this code to your functions.php

    add_filter( 'ot_show_new_layout', '__return_false' );

    Thread Starter WPwebbouw

    (@wpwebbouw)

    Hi Derek,

    Thank you. I must correct my original post. At the time I wrote it the layouts feature was more or less confusing to myself. It may be a very interesting feature to end users. However, the concept of the custom css from different layouts being stored in one and the same dynamic.css file may still need some improvement.

    I am working on a theme where I use the layouts feature to distribute several preset layouts with the theme. The layouts are loaded upon theme installation. I added this function to functions.php:

    /** load standard layouts in options table
     *
     */
    add_action('after_switch_theme', 'bb_setup_options');
    
    function bb_setup_options() {
    	if (file_exists( dirname( __FILE__ ) . '/lib/layouts/stdlayouts.txt')){
    		$stdoptions_file = file_get_contents(dirname( __FILE__ ) . '/lib/layouts/stdlayouts.txt');
    		$stdoptions = unserialize($stdoptions_file);
    	update_option('option_tree_layouts', $stdoptions);
    	}
    }

    The file stdlayouts.txt contains the code in OptionTree->Settings->Export->Layouts

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disable layouts’ is closed to new replies.