Genesis devs: Need help with genesis_get_option()

Community Forums Forums General Discussion Genesis devs: Need help with genesis_get_option()

This topic is: not resolved

This topic contains 1 reply, has 1 voice, and was last updated by  blogjunkie 1 year, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12508

    blogjunkie
    Participant
    Post count: 41

    Hi! I need some help with a plugin I wrote. I only want the code to run on posts and pages. However it’s also trying to run on Premise landing pages. Because these landing pages circumvent the theme, I’m getting a Call to undefined function genesis_get_option() on the Premise pages. Here’s the code:

    add_action( ‘init’, ‘click_fbcomments_init’ );
    function click_fbcomments_init() {

    if ( !is_singular() )
    return;

    // Setup Facebook JS SDK
    add_action( ‘wp_head’, ‘click_fbcomments_jssdk_setup’ );

    // Remove comments & related functions
    remove_action( ‘genesis_comments’, ‘genesis_do_comments’ );
    remove_action( ‘genesis_pings’, ‘genesis_do_pings’ );
    remove_action( ‘genesis_comment_form’, ‘genesis_do_comment_form’ );
    remove_shortcode( ‘post_comments’ );

    // Add Facebook comments
    add_action( ‘genesis_comment_form’, ‘click_do_fbcomments’ );

    // Replace [post_comments] shortcode with Facebook-aware one
    add_shortcode( ‘post_comments’, ‘click_post_fbcomments_shortcode’ );

    }

    Full code: https://github.com/blogjunkie/fb-comments-for-genesis/blob/master/fb-comments-for-genesis.php

    `genesis_get_option()` is called in the `click_fbcomments_jssdk_setup()` function. I tried using `if ( !is_singular() ) return` to prevent the code from running if it’s not a post or page but that doesn’t work.

    Appreciate any help, thanks!


    WordPress evangelist, Nike runner, Apple fanboy.
    Work: ClickWP WordPress Support, Play: adventures of a blogjunkie. Talk to me on Twitter @blogjunkie

    #12849

    blogjunkie
    Participant
    Post count: 41

    Solved it thanks to @kraft! Added a `if ( !function_exists(‘genesis_get_options’) ) return;` to the problem function


    WordPress evangelist, Nike runner, Apple fanboy.
    Work: ClickWP WordPress Support, Play: adventures of a blogjunkie. Talk to me on Twitter @blogjunkie

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.