Version;
} else {
$theme_data = get_theme_data( TEMPLATEPATH . '/style.css');
$theme_version = $theme_data['Version'];
}
$theme_base = get_option('template');
/**************************************************/
add_filter('pre_set_site_transient_update_themes', 'check_fivehundred_update');
function check_fivehundred_update($checked_data) {
global $wp_version, $theme_version, $theme_base, $api_url;
$request = array(
'slug' => $theme_base,
'version' => $theme_version
);
// Start checking for an update
$send_for_check = array(
'body' => array(
'action' => 'theme_update',
'request' => serialize($request),
'api-key' => md5(get_bloginfo('url'))
),
'user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url')
);
$raw_response = wp_remote_post($api_url, $send_for_check);
if (!is_wp_error($raw_response) && ($raw_response['response']['code'] == 200))
$response = unserialize($raw_response['body']);
// Feed the update data into WP updater
if (!empty($response))
$checked_data->response[$theme_base] = $response;
return $checked_data;
}
// Take over the Theme info screen on WP multisite
add_filter('themes_api', 'fivehundred_api_call', 10, 3);
function fivehundred_api_call($def, $action, $args) {
global $theme_base, $api_url, $theme_version, $api_url;
if ($args->slug != $theme_base)
return false;
// Get the current version
$args->version = $theme_version;
$request_string = prepare_request($action, $args);
$request = wp_remote_post($api_url, $request_string);
if (is_wp_error($request)) {
$res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occurred during the API request.
Try again '), $request->get_error_message());
} else {
$res = unserialize($request['body']);
if ($res === false)
$res = new WP_Error('themes_api_failed', __('An unknown error occurred'), $request['body']);
}
return $res;
}
if (is_admin())
$current = get_transient('update_themes');
/**************************************************/
include 'classes/class-video-widget.php';
//include 'classes/class-music-widget.php';
include 'classes/class-content-widget.php';
include 'classes/class-content-alt-widget.php';
include 'classes/class-content-level-widget.php';
include 'classes/class-content-wide-widget.php';
include 'classes/class-content-wide-custom-widget.php';
include 'classes/class-content-alert-widget.php';
include 'classes/class-content-background-left-widget.php';
include 'classes/class-content-background-right-widget.php';
include 'classes/class-content-image-left-widget.php';
include 'classes/class-content-image-right-widget.php';
/**
* Register ignitiondeck domain for translation texts
*/
function fivehundred_init() {
load_theme_textdomain('fivehundred', get_template_directory().'/languages/');
}
add_action('after_setup_theme', 'fivehundred_init');
function fivehundred_dequeue() {
if (isset($_GET['purchaseform'])) {
remove_filter('the_content', 'wpautop');
global $theme_base;
if (isset($theme_base) && $theme_base == 'fivehundred') {
$theme_name = getThemeFileName();
if (!empty($theme_name)) {
wp_dequeue_style($theme_name);
}
}
}
}
add_action('wp_enqueue_scripts', 'fivehundred_dequeue');
function fivehundred_register_admin_menu() {
add_theme_page('500 Settings', '500 Settings', 'manage_options', 'theme-settings', 'fivehundred_admin_menu', plugins_url( '/ignitiondeck/images/ignitiondeck-menu.png'));
}
add_action('admin_menu', 'fivehundred_register_admin_menu');
function fivehundred_admin_menu() {
if (isset($_POST['submit-theme-settings'])) {
$logo = esc_attr($_POST['logo-input']);
$about = stripslashes($_POST['about-us']);
if (isset($_POST['choose-home'])) {
$home = absint($_POST['choose-home']);
}
else {
$home = null;
}
$home_projects = absint($_POST['home-projects']);
$custom_css = stripslashes($_POST['custom_css']);
$ga = stripslashes($_POST['ga']);
if (isset($_POST['twitter-button'])) {
$twitter = absint($_POST['twitter-button']);
}
else {
$twitter = 0;
}
if (isset($_POST['fb-button'])) {
$fb = absint($_POST['fb-button']);
}
else {
$fb = 0;
}
if (isset($_POST['g-button'])) {
$google = absint($_POST['g-button']);
}
else {
$google = 0;
}
if (isset($_POST['li-button'])) {
$li = absint($_POST['li-button']);
}
else {
$li = 0;
}
$twitter_via = esc_attr(str_replace('@', '', $_POST['twitter-via']));
$fbname = esc_attr($_POST['fb-via']);
$gname = esc_attr($_POST['g-via']);
$liname = esc_attr($_POST['li-via']);
$settings = array('logo' => $logo,
'about' => esc_html(html_entity_decode($about)),
'home' => $home,
'home_projects' => $home_projects,
'custom_css' => $custom_css,
'ga' => $ga,
'twitter' => $twitter,
'twitter_via' => $twitter_via,
'fb' => $fb,
'fb_via' => $fbname,
'google' => $google,
'g_via' => $gname,
'li' => $li,
'li_via' => $liname);
update_option('fivehundred_theme_settings', $settings);
echo '
'.__('Settings Saved', 'fivehundred').'
';
}
else {
$settings = get_option('fivehundred_theme_settings');
$logo = $settings['logo'];
$about = html_entity_decode($settings['about']);
$home_projects = $settings['home_projects'];
$custom_css = stripslashes($settings['custom_css']);
$ga = stripslashes($settings['ga']);
$twitter = $settings['twitter'];
$twitter_via = $settings['twitter_via'];
$fb = $settings['fb'];
$fbname = $settings['fb_via'];
$google = $settings['google'];
$gname = $settings['g_via'];
$li = $settings['li'];
$liname = $settings['li_via'];
}
// set up the project home page dropdown
$projects = get_ign_projects();
$levels = '
Grid Layout ';
foreach ($projects as $project) {
$selected = null;
if (isset($_POST['choose-home']) && $_POST['choose-home'] == $project->id) {
$selected = 'selected="selected"';
}
else if ( isset($settings['home']) && $settings['home'] == $project->id) {
$selected = 'selected="selected"';
}
$levels .= ''.__('Single Project', 'fivehundred').': '.stripslashes($project->product_name).' ';
}
$levels .='
';
include 'templates/admin/_themeSettings.php';
}
/* A bunch of filters for category and archive pages */
add_action('init', 'custom_project_filters');
function custom_project_filters() {
if (isset($_GET)) {
if (isset($_GET['project_filter'])) {
add_filter('project_query', 'apply_project_filters');
}
else if (isset($_GET['id_category'])) {
add_filter('project_query', 'apply_project_category', 1);
}
}
}
function apply_project_filters($args) {
$filter = $_GET['project_filter'];
if (isset($_GET['order'])) {
$order = $_GET['order'];
}
else {
$order = 'DESC';
}
if ($filter == 'date') {
$args['orderby'] = 'date';
}
else {
$args['orderby'] = 'meta_value_num';
$args['meta_key'] = $filter;
}
$args['order'] = $order;
return $args;
}
function apply_project_category($args) {
$tax_slug = $_GET['id_category'];
if (!empty($tax_slug)) {
$tax_cat = get_term_by('slug', $tax_slug, 'project_category');
if (!empty($tax_cat)) {
$args['project_category'] = $tax_slug;
}
}
return $args;
}
add_action('pre_get_posts', 'projects_archive_display');
function projects_archive_display($query) {
if (is_post_type_archive('ignition_product')) {
$query->set('posts_per_page',9);
return;
}
}
add_filter('pre_get_posts', 'add_projects_to_cat');
function add_projects_to_cat($query) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$post_types = get_post_types();
$post_types = array_merge($post_types, array('ignition_product'));
$query->set('post_type', $post_types);
}
return $query;
}
function the_project_summary($id) {
$project_id = get_post_meta($id, 'ign_project_id', true);
$project = new ID_Project($project_id);
$image_url = the_project_image($id, "1");
$name = get_post_meta($id, 'ign_product_name', true);
$short_desc = html_entity_decode(get_post_meta($id, 'ign_project_description', true));
$total = get_fund_total($id);
$goal = the_project_goal($id);
$end = get_post_meta($id, 'ign_fund_end', true);
$end_type = get_post_meta($id, 'ign_end_type', true);
$days_left = $project->days_left();
// ID Function
// GETTING product default settings
$default_prod_settings = getProductDefaultSettings();
// Getting product settings and if they are not present, set the default settings as product settings
$prod_settings = getProductSettings($project_id);
if (empty($prod_settings)) {
$prod_settings = $default_prod_settings;
}
$currency_code = $prod_settings->currency_code;
//GETTING the currency symbols
$cCode = setCurrencyCode($currency_code);
if ($end !== '') {
$show_dates = true;
}
else {
$show_dates = false;
}
// percentage bar
if ($total <= 0 || $goal <= 0) {
$percentage = 0;
}
else {
$percentage = $total / $goal * 100;
}
$summary = new stdClass;
$summary->end_type = $end_type;
$summary->image_url = $image_url;
$summary->name = $name;
$summary->short_description = $short_desc;
$summary->total = $total;
$summary->goal = $goal;
$summary->show_dates = $show_dates;
if ($show_dates == true) {
$summary->days_left = $days_left;
}
$summary->percentage = $percentage;
$summary->currency_code = $cCode;
return $summary;
}
function the_project_content($id) {
$project_id = get_post_meta($id, 'ign_project_id', true);
$name = get_post_meta($id, 'ign_product_name', true);
$short_desc = html_entity_decode(get_post_meta($id, 'ign_project_description', true));
$long_desc = get_post_meta($id, 'ign_project_long_description', true);
$content = new stdClass;
$content->name = $name;
$content->short_description = $short_desc;
$content->long_description = apply_filters('fh_project_content', html_entity_decode($long_desc), $project_id);
return $content;
}
function the_project_hDeck($id) {
// *payment button, *learn more,
$project_id = get_post_meta($id, 'ign_project_id', true);
$goal = the_project_goal($id);
$total = get_fund_total($id);
// GETTING product default settings
$default_prod_settings = getProductDefaultSettings();
$end_type = get_post_meta($id, 'ign_end_type', true);
// Getting product settings and if they are not present, set the default settings as product settings
$prod_settings = getProductSettings($project_id);
if (empty($prod_settings)) {
$prod_settings = $default_prod_settings;
}
$currency_code = $prod_settings->currency_code;
//GETTING the currency symbols
$cCode = setCurrencyCode($currency_code);
// date info
$end_raw = get_post_meta($id, 'ign_fund_end', true);
if ($end_raw !== '') {
$show_dates = true;
$end = str_replace('/', ' ', $end_raw);
$end = explode(' ', $end);
$end_string = $end[2].'-'.$end[0].'-'.$end[1];
$month = $end[0];
$day = $end[1];
$year = $end[2];
$end_date = strtotime($end_string);
$now = time();
// days left
$dif = number_format(($end_date - $now)/86400);
if ($dif < 0) {
$dif = 0;
}
}
else {
$show_dates = false;
}
// percentage bar
if ($total == 0) {
$percentage = 0;
}
else {
$percentage = $total / $goal * 100;
}
$pledges_count = get_backer_total($id);
$button_url = null;
$hDeck = new stdClass;
$hDeck->end_type = $end_type;
$hDeck->goal = $goal;
$hDeck->total = $total;
$hDeck->show_dates = $show_dates;
if ($show_dates == true) {
$hDeck->end = $end_raw;
$hDeck->day = $day;
$hDeck->month = date('F', mktime(0, 0, 0,$month, 10));
$hDeck->year = $year;
$hDeck->days_left = $dif;
}
$hDeck->percentage = $percentage;
$hDeck->pledges = $pledges_count;
$hDeck->currency_code = $cCode;
return $hDeck;
}
function the_project_video($id) {
$video = get_post_meta($id, 'ign_product_video', true);
return html_entity_decode($video);
}
function the_levels($id) {
global $wpdb;
$project_id = get_post_meta($id, 'ign_project_id', true);
$level_count = get_post_meta($id, 'ign_product_level_count', true);
// GETTING product default settings
$default_prod_settings = getProductDefaultSettings();
// Getting product settings and if they are not present, set the default settings as product settings
$prod_settings = getProductSettings($project_id);
if (empty($prod_settings)) {
$prod_settings = $default_prod_settings;
}
$currency_code = $prod_settings->currency_code;
//GETTING the currency symbols
$cCode = setCurrencyCode($currency_code);
$level_data = array();
for ($i=1; $i <= $level_count; $i++) {
$level_sales = $wpdb->prepare('SELECT COUNT(*) as count FROM '.$wpdb->prefix.'ign_pay_info WHERE product_id=%d AND product_level = %d', $project_id, $i);
$return_sales = $wpdb->get_row($level_sales);
$level_sales = $return_sales->count;
if ($i == 1) {
$level_title = html_entity_decode(get_post_meta($id, 'ign_product_title', true));
$level_desc = html_entity_decode(get_post_meta($id, 'ign_product_details', true));
$level_price = get_post_meta($id, 'ign_product_price', true);
if ($level_price > 0) {
$level_price = number_format($level_price, 0, '.', ',');
}
$level_limit = get_post_meta($id, 'ign_product_limit', true);
$level_order = get_post_meta($id, 'ign_projectmeta_level_order', true);
$level_data[] = array('id' => $i,
'title' => $level_title,
'description' => $level_desc,
'price' => $level_price,
'sold' => $level_sales,
'limit' => $level_limit,
'currency_code' => $cCode,
'order' => $level_order);
}
else {
$level_title = html_entity_decode(get_post_meta($id, 'ign_product_level_'.$i.'_title', true));
$level_desc = html_entity_decode(get_post_meta($id, 'ign_product_level_'.$i.'_desc', true));
$level_price = get_post_meta($id, 'ign_product_level_'.$i.'_price', true);
if ($level_price > 0) {
$level_price = number_format($level_price, 0, '.', ',');
}
$level_limit = get_post_meta($id, 'ign_product_level_'.$i.'_limit', true);
$level_order = get_post_meta($id, 'ign_product_level_'.$i.'_order', true);
$level_data[] = array('id' => $i,
'title' => $level_title,
'description' => $level_desc,
'price' => $level_price,
'limit' => $level_limit,
'sold' => $level_sales,
'currency_code' => $cCode,
'order' => $level_order);
}
}
return $level_data;
}
function fh_level_sort($a, $b) {
return $a['order'] == $b['order'] ? 0 : ($a['order'] > $b['order']) ? 1 : -1;
}
function have_projects() {
global $wpdb;
$proj_return = get_ign_projects();
if ($proj_return) {
return true;
}
else {
return false;
}
}
// not in use --
function the_project($id) {
$project_id = get_post_meta($id, 'ign_project_id', true);
$project = get_ign_project($project_id);
$pay_info = get_pay_info($project_id);
$fund_total = array('fund_total' => get_fund_total($pay_info));
$meta = get_post_meta($id);
$the_project = array_merge( $project, $pay_info, $fund_total, $meta);
return $the_project;
}
function get_ign_project($id) {
global $wpdb;
$proj_query = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'ign_products WHERE id=%d', absint($id));
$proj_return = $wpdb->get_row($proj_query);
return $proj_return;
}
function get_ign_projects() {
global $wpdb;
$proj_query = 'SELECT * FROM '.$wpdb->prefix.'ign_products';
$proj_return = $wpdb->get_results($proj_query);
return $proj_return;
}
function get_pay_info($id) {
global $wpdb;
$pay_query = $wpdb->prepare('SELECT * FROM '.$wpdb->prefix.'ign_pay_info WHERE product_id=%d', absint($id));
$pay_return = $wpdb->get_results($pay_query);
return $pay_return;
}
function get_fund_total($id) {
$project_id = get_post_meta($id, 'ign_project_id', true);
$pay_info = get_pay_info($project_id);
$total = 0;
foreach ($pay_info as $fund) {
$total = $total + $fund->prod_price;
}
return $total;
}
function get_backer_total($id) {
global $wpdb;
$project_id = get_post_meta($id, 'ign_project_id', true);
$get_pledgers = $wpdb->prepare('SELECT COUNT(*) AS count FROM '.$wpdb->prefix.'ign_pay_info WHERE product_id=%d', $project_id);
$return_pledgers = $wpdb->get_row($get_pledgers);
return $return_pledgers->count;
}
function the_project_image($id, $num) {
if ($num == 1) {
$project_id = get_post_meta($id, 'ign_project_id', true);
global $wpdb;
$url = get_post_meta($id, 'ign_product_image1', true);
$sql = $wpdb->prepare('SELECT ID FROM '.$wpdb->prefix.'posts WHERE guid = %s', $url);
$res = $wpdb->get_row($sql);
if (isset($res->ID)) {
$src = wp_get_attachment_image_src($res->ID, 'fivehundred_featured');
$image = $src[0];
} else {
$image = $url;
}
}
else {
$key = 'ign_product_image'.$num;
$image = get_post_meta($id, $key, true);
}
return $image;
}
function the_project_goal($id) {
global $wpdb;
$project_id = get_post_meta($id, 'ign_project_id', true);
$goal_query = $wpdb->prepare('SELECT goal FROM '.$wpdb->prefix.'ign_products WHERE id=%d', $project_id);
$goal_return = $wpdb->get_row($goal_query);
if (!empty($goal_return->goal)) {
$goal = $goal_return->goal;
}
else {
$goal = 0;
}
return $goal;
}
function fh_fa_shortcodes($attrs) {
if (isset($attrs)) {
$icon = 'fa fa-'.$attrs['type'];
if (isset($attrs['size'])) {
$size = 'fa-'.$attrs['size'];
}
else {
$size = null;
}
$output = ' ';
}
else {
$output = '';
}
return $output;
}
add_shortcode('icon', 'fh_fa_shortcodes');
// This is below
add_action('after_setup_theme', 'fivehundred_setup');
function fivehundred_setup(){
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'menus' );
register_nav_menus(
array(
'main-menu' => __( 'Main Menu', 'fivehundred' ),
'footer-menu' => __( 'Footer Menu', 'fivehundred' )
)
);
add_theme_support( 'woocommerce' );
add_filter('wp_nav_menu_items', 'fh_my_account_link', 5, 2);
add_action('wp_head', 'fh_color_styles', 999);
}
/** Wordpress Theme Customizer **/
function fivehundred_customize_register( $wp_customize ) {
$colors = array();
$colors[] = array(
'slug'=>'fh_primary_color',
'default' => '#3B7BB3',
'priority' => 1,
'label' => __('Primary Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_primary_light_color',
'default' => '#EDF5FF',
'priority' => 2,
'label' => __('Primary Light Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_primary_dark_color',
'default' => '#2B6496',
'priority' => 3,
'label' => __('Primary Dark Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_secondary_color',
'default' => '#FF8872',
'priority' => 4,
'label' => __('Secondary Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_secondary_dark_color',
'default' => '#D93B1E',
'priority' => 5,
'label' => __('Secondary Dark Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_text_color',
'default' => '#222222',
'priority' => 6,
'label' => __('Text Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_text_subtle_color',
'default' => '#666666',
'priority' => 7,
'label' => __('Subtle Text Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_text_onprimary_color',
'default' => '#fff',
'priority' => 8,
'label' => __('Text Color On Primary Background', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_container_background_color',
'default' => '#fff',
'priority' => 9,
'label' => __('Container Background Color', 'fivehundred')
);
$colors[] = array(
'slug'=>'fh_site_background_color',
'default' => '#F1F4F7',
'priority' => 10,
'label' => __('Site Background Color', 'fivehundred')
);
foreach( $colors as $color ) {
// SETTINGS
$wp_customize->add_setting(
$color['slug'], array(
'default' => $color['default'],
'type' => 'option',
'capability' =>
'edit_theme_options'
)
);
// CONTROLS
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
$color['slug'],
array('label' => $color['label'],
'section' => 'colors',
'settings' => $color['slug'],
'priority' => $color['priority'])
)
);
}
}
add_action( 'customize_register', 'fivehundred_customize_register' );
function fh_color_styles() {
$primary_color = get_option('fh_primary_color');
$primary_light_color = get_option('fh_primary_light_color');
$primary_dark_color = get_option('fh_primary_dark_color');
$secondary_color = get_option('fh_secondary_color');
$secondary_dark_color = get_option('fh_secondary_dark_color');
$text_color = get_option('fh_text_color');
$text_subtle_color = get_option('fh_text_subtle_color');
$text_onprimary_color = get_option('fh_text_onprimary_color');
$site_background_color = get_option('fh_site_background_color');
$container_background_color = get_option('fh_container_background_color');
$customized = false;
if (!empty($primary_color) || !empty($primary_light_color) || !empty($primary_dark_color) || !empty($secondary_color) || !empty($secondary_dark_color) || !empty($text_color) || !empty($text_subtle_color) || !empty($text_onprimary_color) || !empty($site_background_color) || !empty($container_background_color)) {
$customized = true;
}
if ($customized) {
// Convert Sidebar from Hex to RGB
if ( !empty($primary_color) && $primary_color !== '#3B7BB3') {
$hexs = str_replace("#", "", $primary_color);
if (strlen($hexs) == 3) {
$rs = hexdec(substr($hexs,0,1).substr($hexs,0,1));
$gs = hexdec(substr($hexs,1,1).substr($hexs,1,1));
$bs = hexdec(substr($hexs,2,1).substr($hexs,2,1));
}
else {
$rs = hexdec(substr($hexs,0,2));
$gs = hexdec(substr($hexs,2,2));
$bs = hexdec(substr($hexs,4,2));
}
}
if (!empty($site_background_color) && $site_background_color !== '#F1F4F7') {
$hexs = str_replace("#", "", $site_background_color);
if (strlen($hexs) == 3) {
$rb = hexdec(substr($hexs,0,1).substr($hexs,0,1));
$gb = hexdec(substr($hexs,1,1).substr($hexs,1,1));
$bb = hexdec(substr($hexs,2,1).substr($hexs,2,1));
}
else {
$rb = hexdec(substr($hexs,0,2));
$gb = hexdec(substr($hexs,2,2));
$bb = hexdec(substr($hexs,4,2));
}
}
?>
theme_location == 'main-menu') {
if (is_user_logged_in()) {
$items .= ''.__('My Account', 'fivehundred').' ';
}
else {
$items .= ''.__('Create Account', 'fivehundred').' ';
$items .= ''.__('Login', 'fivehundred').' ';
}
}
}
return $items;
}
// Image Sizes added and Allowing to select those image sizes in Media Insert Admin
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'projectpage-large', 640, 9999 ); // For Project Pages with Unlimited Height allowed
add_image_size( 'single-thumb', 700, 105, true ); // For Single Posts (cropped)
add_image_size( 'fivehundred_featured', 624, 360, true); // For 500 Featured Project
}
add_filter( 'image_size_names_choose', 'custom_image_sizes_choose' );
function custom_image_sizes_choose( $sizes ) {
$custom_sizes = array(
'projectpage-large' => 'Project Page Full Width',
'single-thumb' => 'Single Post Thumb',
'fh_feature' => 'Fivehundred Feature'
);
return array_merge( $sizes, $custom_sizes );
}
// for custom comments
if ( ! function_exists( 'fivehundred_comment' ) ) :
/**
* Template for comments and pingbacks.
*
* To override this walker in a child theme without modifying the comments template
* simply create your own fivehundred_comment(), and that function will be used instead.
*
* Used as a callback by wp_list_comments() for displaying the comments.
*
*/
function fivehundred_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
__('Sidebar Widget Area', 'fivehundred'),
'id' => 'primary-widget-area',
'before_widget' => ' ',
'after_widget' => " ",
'before_title' => ''
));
register_sidebar(array(
'name' => __('Projects Sidebar Area', 'fivehundred'),
'id' => 'projects-widget-area',
'before_widget' => '',
'after_widget' => " ",
'before_title' => '',
'description' => __( 'This sidebar is located below the Levels on each Project page.', 'fivehundred' )
));
register_sidebar(array(
'name' => __('Home Sidebar Area', 'fivehundred'),
'id' => 'home-widget-area',
'before_widget' => '',
'after_widget' => " ",
'before_title' => '',
'description' => __( 'This sidebar is located on the Home Page, to the right of About Us', 'fivehundred' )
));
$sidebar = register_sidebar(array(
'name' => __('Home Content Widgets', 'fivehundred'),
'description' => __('This is a widget area on Project Grid home and Single Project home, below Featurd Projects or the Project Deck.', 'fivehundred'),
'id' => 'home-content-widget-area',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
$sidebar = register_sidebar(array(
'name' => __('Home Top Content Widgets', 'fivehundred'),
'description' => __('This is a widget area on Project Grid home, directly above the Project Grid', 'fivehundred'),
'id' => 'home-top-content-widget-area',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
));
do_action('fivehundred_widgets_init');
}
}
$preset_widgets = array (
'primary-aside' => array( 'search', 'pages', 'categories', 'archives' ),
);
// add Google Analytics Code to footer
add_action('wp_footer', 'fh_ga_code');
function fh_ga_code() {
$settings = get_option('fivehundred_theme_settings');
if (is_array($settings) && isset($settings['ga'])) {
$ga = stripslashes($settings['ga']);
echo str_replace('"', '', $ga);
}
}
add_action('wp_head', 'fh_custom_css');
function fh_custom_css() {
$settings = get_option('fivehundred_theme_settings');
if (is_array($settings) && isset($settings['custom_css'])) {
$custom_css = stripslashes($settings['custom_css']);
echo '';
}
}
function widont($str = '')
{
$str = rtrim($str);
$space = strrpos($str, ' ');
if ($space !== false)
{
$str = substr($str, 0, $space).' '.substr($str, $space + 1);
}
return $str;
}
add_filter('the_title', 'widont');
function fivehundred_admin_notice(){
if (!is_plugin_active('ignitiondeck/ignitiondeck.php')) {
echo '';
}
}
add_action('admin_notices', 'fivehundred_admin_notice');
function fh_font_awesome() {
wp_register_style('font-awesome', DIRNAME(get_bloginfo('stylesheet_url')).'/inc/css/font-awesome.css');
wp_enqueue_style('font-awesome');
//wp_register_style('classic-green', DIRNAME(get_bloginfo('stylesheet_url')).'/style-green.css');
//wp_enqueue_style('classic-green');
}
add_action('wp_enqueue_scripts', 'fh_font_awesome');
/**
* Required by WordPress
**/
if ( ! isset( $content_width ) ) {
$content_width = 960;
}
/**
* WooCommerce
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'fivehundred_wc_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'fivehundred_wc_wrapper_end', 10);
function fivehundred_wc_wrapper_start() {
echo '';
echo '
';
}
function fivehundred_wc_wrapper_end() {
echo ' ';
}
?>