[Resolved] Problem with function in hook element

Home Forums Support Problem with function in hook element

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1439931
    Carsten

    Hi there, I’m adding this snippet to a hook element, but this partly breaks the site

    <?php  
    hmk_show_matching_percentage();  
    ?>

    This is the function, which is working, but I want to control the position of it with a hook. It does not matter which hook I select, same result.

    /**
      * Load the matching stuff only if BuddyPress is active.
      */
      function mp_bp_match_init() {
    
          require_once('src/class.settings-api.php');
      		require_once('mp-settings.php');
    
          new WeDevs_Settings_API_Match();
    
          add_action('wp_footer', array($this, 'hmk_script'), 100);
    
     
    
    <blockquote>Function from this line:</blockquote>
    
      add_action('bp_profile_header_meta', array($this, 'hmk_show_matching_percentage'), 10);
          add_action('bp_directory_members_item', array($this, 'hmk_matching_percentage_button'), 10);
    
          add_shortcode( 'mp_match_percentage', array($this, 'mp_match_percentage_function'));
    
          add_action('wp_ajax_hmk_get_percentage', array($this, 'hmk_get_percentage_function'), 100);
          add_action('wp_ajax_nopriv_hmk_get_percentage', array($this, 'hmk_get_percentage_function'), 100);
    
       }

    Any idea why this code snippet

    <?php  
    hmk_show_matching_percentage();  
    ?>

    pasted in a hook element is breaking the site?

    Thanks!

    #1439939
    Leo
    Staff
    Customer Support

    Hi there,

    The hook element doesn’t alter or change the function for you – it simply adds the function to the desired location so I’d assume the function itself is causing the issue.

    Maybe try removing each line one by one to determine the issue that way?

    That is not a theme related function so not sure how much help we can provide here.

    #1439950
    Carsten

    Okay, thanks anyway!

    #1440043
    Leo
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.