Skip to content

Instantly share code, notes, and snippets.

@robhob
Forked from mrkdevelopment/In your social icons file
Created November 24, 2018 13:30
Show Gist options
  • Save robhob/6189664e699c5eb11f71fcf891846a6d to your computer and use it in GitHub Desktop.
Save robhob/6189664e699c5eb11f71fcf891846a6d to your computer and use it in GitHub Desktop.

Revisions

  1. @mrkdevelopment mrkdevelopment created this gist Jun 18, 2016.
    62 changes: 62 additions & 0 deletions In your functions file
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,62 @@
    /**
    * Loads theme settings
    *
    */
    if ( ! function_exists( 'et_load_core_options' ) ) {

    function et_load_core_options() {

    global $shortname, $$themename;
    require_once get_template_directory() . esc_attr( "/options_{$shortname}.php" );
    $newOptions = [];
    foreach ($options as $i => $optionArray) {
    $newOptions[] = $optionArray;
    if (isset($optionArray['id']) && $optionArray['id'] == 'divi_show_google_icon') {

    $showOptions = array(
    "name" =>esc_html__( "Show Linked In Icon", $themename ),
    "id" => $shortname."_show_linkedin_icon",
    "type" => "checkbox2",
    "std" => "on",
    "desc" =>esc_html__( "Here you can choose to display the LINKED IN Icon. ", $themename ) );

    $newOptions[] = $showOptions;

    $showOptions2 = array(
    "name" =>esc_html__( "Show Youtube Icon", $themename ),
    "id" => $shortname."_show_youtube_icon",
    "type" => "checkbox2",
    "std" => "on",
    "desc" =>esc_html__( "Here you can choose to display the Youtube Icon. ", $themename ) );


    $newOptions[] = $showOptions2;
    }

    if (isset($optionArray['id']) && $optionArray['id'] == 'divi_google_url') {

    $urlOptions = array( "name" =>esc_html__( "Linked In Profile Url", $themename ),
    "id" => $shortname."_linkedin_url",
    "std" => "#",
    "type" => "text",
    "validation_type" => "url",
    "desc" =>esc_html__( "Enter the URL of your LinkedIn Profile. ", $themename ) );

    $urlOptions2 = array( "name" =>esc_html__( "Youtube Url", $themename ),
    "id" => $shortname."_youtube_url",
    "std" => "#",
    "type" => "text",
    "validation_type" => "url",
    "desc" =>esc_html__( "Enter the URL of your Youtube Channel. ", $themename ) );

    $newOptions[] = $urlOptions;

    $newOptions[] = $urlOptions2;
    }
    }

    $options = $newOptions;

    }

    }
    15 changes: 15 additions & 0 deletions In your social icons file
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <?php if ( 'on' === et_get_option( 'divi_show_linkedin_icon', 'on' ) ) : ?>
    <li class="et-social-icon et-social-linkedin">
    <a href="<?php echo esc_url( et_get_option( 'divi_linkedin_url', '#' ) ); ?>" class="icon">
    <span><?php esc_html_e( 'Linked In', 'Divi' ); ?></span>
    </a>
    </li>
    <?php endif; ?>

    <?php if ( 'on' === et_get_option( 'divi_show_youtube_icon', 'on' ) ) : ?>
    <li class="et-social-icon et-social-youtube">
    <a href="<?php echo esc_url( et_get_option( 'divi_youtube_url', '#' ) ); ?>" class="icon">
    <span><?php esc_html_e( 'Youtube', 'Divi' ); ?></span>
    </a>
    </li>
    <?php endif; ?>