Skip to content

Instantly share code, notes, and snippets.

@mrkdevelopment
Created January 22, 2018 02:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkdevelopment/50d6c3357ccf87aba7f3a07843cd00a1 to your computer and use it in GitHub Desktop.
Save mrkdevelopment/50d6c3357ccf87aba7f3a07843cd00a1 to your computer and use it in GitHub Desktop.
Icon Child Theme Helper File
<?php
class DF_Icons_Helper
{
/**
* Get unique options keys. Will be used to indentify duplicates.
*/
public function get_options_keys($options)
{
$optionKeys = array();
foreach ($options as $i => $option) {
if (is_array($option) and isset($option['id'])) {
$optionKeys[] = $option['id'];
}
}
return $optionKeys;
}
/**
* Get Social options
*/
public function get_social_options($shortname, $themename)
{
$options = array();
// Icons.
$options['divi_show_google_icon'][] = 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)
);
$options['divi_show_google_icon'][] = 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)
);
$options['divi_show_google_icon'][] = array(
"name" =>esc_html__("Show Instagram Icon", $themename),
"id" => $shortname."_show_instagram_icon",
"type" => "checkbox2",
"std" => "on",
"desc" =>esc_html__("Here you can choose to display the Instagram Icon. ", $themename)
);
$options['divi_show_google_icon'][] = array(
"name" =>esc_html__("Show Trip Advisor Icon", $themename),
"id" => $shortname."_show_tripadvisor_icon",
"type" => "checkbox2",
"std" => "on",
"desc" =>esc_html__("Here you can choose to display the Trip Advisor Icon. ", $themename)
);
$options['divi_show_google_icon'][] = array(
"name" =>esc_html__("Show Houzz Icon", $themename),
"id" => $shortname."_show_houzz_icon",
"type" => "checkbox2",
"std" => "on",
"desc" =>esc_html__("Here you can choose to display the Houzz Icon. ", $themename)
);
// Add your icon toggle switch definition here.
$options['divi_show_google_icon'][] = array(
"name" =>esc_html__("Show Paypal Icon", $themename),
"id" => $shortname."_show_paypal_icon",
"type" => "checkbox2",
"std" => "on",
"desc" =>esc_html__("Here you can choose to display the Paypal Icon. ", $themename)
);
// URLS
$options['divi_google_url'][] = 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)
);
$options['divi_google_url'][] = 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)
);
$options['divi_google_url'][] = array(
"name" =>esc_html__("Instagram Url", $themename),
"id" => $shortname."_instagram_url",
"std" => "#",
"type" => "text",
"validation_type" => "url",
"desc" =>esc_html__("Enter the URL of your Instagram profile. ", $themename)
);
$options['divi_google_url'][] = array(
"name" =>esc_html__("Trip Advisor Url", $themename),
"id" => $shortname."_tripadvisor_url",
"std" => "#",
"type" => "text",
"validation_type" => "url",
"desc" =>esc_html__("Enter the URL of your Instagram profile. ", $themename)
);
$options['divi_google_url'][] = array(
"name" =>esc_html__("Houzz Url", $themename),
"id" => $shortname."_houzz_url",
"std" => "#",
"type" => "text",
"validation_type" => "url",
"desc" =>esc_html__("Enter the URL of your Houzz Profile. ", $themename)
);
// Add your social icon url definition here.
$options['divi_google_url'][] = array(
"name" =>esc_html__("Paypal Url", $themename),
"id" => $shortname."_paypal_url",
"std" => "#",
"type" => "text",
"validation_type" => "url",
"desc" =>esc_html__("Enter the URL of your Paypal Profile. ", $themename)
);
return $options;
}
}
@mrkdevelopment
Copy link
Author

To see a full implementation of this technique you can download my free plugin here -https://www.diviframework.com/wp/divi-icon-toolkit/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment