Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter aminfri

    (@aminfri)

    I noticed this little nice function in the source code that returns the label:

    [ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]

    function ot_get_meta_label( $id ) {
      if ( empty( $id ) )
        return false;
      $settings = get_option('rj'.ot_settings_id());
      if ( empty( $settings['settings'] ) )
        return false;
      foreach( $settings['settings'] as $setting ) {
        if ( $setting['id'] == $id && isset( $setting['label'] ) ) {
          return $setting['label'];
        }
      }
    }

    This can be used to retrieve the description field as well:

    function ot_get_meta_desc( $id ) {
      if ( empty( $id ) )
        return false;
      $settings = get_option('rj'.ot_settings_id());
      if ( empty( $settings['settings'] ) )
        return false;
      foreach( $settings['settings'] as $setting ) {
        if ( $setting['id'] == $id && isset( $setting['desc'] ) ) {
          return $setting['desc'];
        }
      }
    }

    Hope that helps a fellow dev.

Viewing 1 replies (of 1 total)