• Resolved PDidee

    (@pdidee)


    Hi there I’m trying to upgrade my option tree from 2.0.12 to the current version v2.4.2 however I’m getting the white screen of death when I replace the “option-tree” folder integrated within my theme. I have the following function calls:

    add_filter( 'ot_show_pages', '__return_false' );
    add_filter( 'ot_theme_mode', '__return_true' );
    
    require( trailingslashit( get_template_directory() ) . 'option-tree/ot-loader.php' );
    
    require( trailingslashit( get_template_directory() ) . 'includes/theme-options.php' );

    Can someone help? the two offending files seem to be “ot-loader.php” & “ot-ui-theme-options.php” (Now missing from v2.4.2)

    Thanks in advance
    P

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

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

    (@valendesigns)

    To me it seems you have an issue with calling the ot_get_option() function before it’s available.

    There is a fundamental difference between the 2.0.x branch & any 2.1+ branch in how it get’s loaded. OptionTree 2.1+ is loaded on the after_setup_theme action at priority 1. So if your theme is calling the ot_get_option() function before it’s loaded you’ll get an error message.

    Wrap the current code you have in the functions.php in a function and call it via an action hook. The following is a very basic explanation.

    Old code

    $my_option = ot_get_option('option_id');
    echo $my_option;

    New code

    function my_custom_function() {
      $my_option = ot_get_option('option_id');
      echo $my_option;
    }
    add_action( 'after_setup_theme', 'my_custom_function' );

    If this is not the issue please tell me more about what error messages you received after you upgraded OptionTree.

    Thread Starter PDidee

    (@pdidee)

    I actually got it working but I had to alter two lines of code within ot-loader.php. Apparently there was a conflict of some sort with the line: public function __construct() { so I had to keep the original one and rename the first instance public function __construct2() {
    Not sure why but all seems to be working okay now.

    Plugin Author Derek Herman

    (@valendesigns)

    Not saying that you didn’t get it working, but how you got it working makes very little sense to me. By renaming the constructor you are in essence stopping OptionTree from loading. Do you by chance have two OptionTree installs, one in the theme and one as a plugin?

    Thread Starter PDidee

    (@pdidee)

    Nope no plugin installed all of it’s through theme mode. I basically inheirited a theme that is no longer supported but I liked the framework so much I revamped most of the code. It originally had OptionTree v2.0.12 in it and I was able to upgrade that to v2.1.1 but after that v2.1.2 on just yielded a white screen of death. So I then replaced all the files except “ot-loader.php” and that still worked so that narrowed the issue down to that file which i then preformed a dif and slowly replaced the old code with the new code line by line from the bottom up. I ran into an issue when I came to public function load_optiontree() { I needed to comment that line out and replace it with public function __construct(){ then I needed to rename public function __construct(){ on line 50 to public function __construct2(){
    to get it all working again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Trying to upgrade from v2.0.12’ is closed to new replies.