WordPress.org

Ready to get started?Download WordPress

Forums

Hueman
Getting an Error when trying to create a Front-end form using ACF (6 posts)

  1. and0r1995
    Member
    Posted 1 month ago #

    Hey,

    I'm working on a custom project with this theme. I use Advanced Custom fields plugin, and I created a new page template for my front-end form. But when I add the acf_form_head(); function to the template, I get the following error:

    Fatal error: Call to undefined function ot_get_media_post_ID() in E:\htdocs\wp.andornagy.info\wp-content\themes\hueman\option-tree\ot-loader.php on line 667

    Thanks.

  2. nmhall
    Member
    Posted 2 weeks ago #

    I'm getting this very issue, a conflict between the Option Tree in the Hueman theme and the ACF plugin...

  3. nmhall
    Member
    Posted 2 weeks ago #

    Found this link, which helps somewhat: https://github.com/AlxMedia/hueman/issues/62

    especially the link in that post to this:
    http://premium.wpmudev.org/forums/topic/fatal-error-call-to-undefined-function-3

    I've done as the op said and removed this part from ot-loader.php:

    public function shortcode( $settings, $post ) {
    
    // Set the OptionTree post ID
    if ( ! is_object( $post ) )
    $settings['post']['id'] = ot_get_media_post_ID();
    
    // No ID return settings
    if ( $settings['post']['id'] == 0 )
    return $settings;
    
    // Set the fake shortcode
    $settings['ot_gallery'] = array( 'shortcode' => "[gallery id='{$settings['post']['id']}']" );
    
    // Return settings
    return $settings;
    
    }

    Now I'm getting the following error message though:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'OT_Loader' does not have a method 'shortcode' in /[ROOT]/wp-includes/plugin.php on line 192

  4. nmhall
    Member
    Posted 2 weeks ago #

    I really hate doing this, but I went ahead and just commented out this portion of the above referenced code and I'm not getting errors anymore.

    $settings['post']['id'] = ot_get_media_post_ID();

    Fingers crossed it will do the job. I've seen this issue brought up on the theme dev's site but still no solution.

  5. azherahmed
    Member
    Posted 2 weeks ago #

    A cleaner fix is to change this line:
    if ( ! is_object( $post ) )
    To this:
    if ( ! is_object( $post ) && function_exists('ot_get_media_post_ID'))

    That fixed it for me. Let's hope the next Hueman release includes a fix for this bug.

  6. nmhall
    Member
    Posted 2 weeks ago #

    Ah, that's what I needed, thanks azherahmed!

Reply

You must log in to post.

About this Theme

About this Topic