Follow us on

  1. Posted 1 year ago #

  2. Codestar
    Admin

    Hi,

    // Suppose you have a custom get option function.
    if ( ! function_exists( 'siberatak_get_option' ) ) {
      function siberatak_get_option( $option = '', $default = null ) {
        $options = get_option( 'YOUR_FRAMEWORK_UNIQUE_ID_HERE' ); // Attention: Set your unique id of the framework
        return ( isset( $options[ $option ] ) && $options[ $option ] !== '' ) ? $options[ $option ] : $default;
      }
    }CopyCopied!
    // Suppose your group config like this
    array(
      'id'     => 'socials',
      'type'   => 'group',
      'title'  => 'Social Network',
      'fields' => array(
        array(
          'id'    => 'link',
          'type'  => 'text',
          'title' => 'Link',
        ),
        array(
          'id'    => 'icon',
          'type'  => 'icon',
          'title' => 'Icon',
        ),
      )
    ),CopyCopied!

    Now, we can start code:

    $socials = siberatak_get_option( 'socials' );
    
    if ( ! empty( $socials ) ) {
      foreach ( $socials as $social ) {
        if ( ! empty( $social['link'] ) && ! empty( $social['icon'] ) ) {
          echo '<a target="_blank" rel="nofollow"  href="'. esc_url( $social['link'] ) .'"><i class="'. esc_attr( $social['icon'] ) .'"></i></a>';
        }
      }
    }CopyCopied!

    I hope you need that exactly.

    Regards, Codestar

    Posted 1 year ago #

  3. Posted 1 year ago #

  4. Codestar
    Admin

    You're welcome

    Posted 1 year ago #