示例#1
0
 /**
  * Init class properties after_setup_theme
  * Fixes the bbpress bug : Notice: bbp_setup_current_user was called incorrectly. The current user is being initialized without using $wp->init()
  * hu_get_default_options uses is_user_logged_in() => was causing the bug
  * hook : after_setup_theme
  *
  */
 function hu_init_properties()
 {
     //all theme options start by "hu_" by convention
     //$this -> hu_options_prefixes = apply_filters('hu_options_prefixes', array('hu_') );
     $this->is_customizing = hu_is_customizing();
     $this->db_options = false === get_option(HU_THEME_OPTIONS) ? array() : (array) get_option(HU_THEME_OPTIONS);
     $this->default_options = $this->hu_get_default_options();
     $_trans = 'started_using_hueman';
     //What was the theme version when the user started to use Hueman?
     //new install = no options yet
     //very high duration transient, this transient could actually be an option but as per the wordpress.org themes guidelines, only one option is allowed for the theme settings
     if (1 >= count($this->db_options) || !esc_attr(get_transient($_trans))) {
         set_transient($_trans, sprintf('%s|%s', 1 >= count($this->db_options) ? 'with' : 'before', HUEMAN_VER), 60 * 60 * 24 * 3650);
     }
 }
示例#2
0
 function hu_print_social_links()
 {
     $_socials = hu_get_option('social-links');
     if (empty($_socials)) {
         return;
     }
     echo '<ul class="social-links">';
     foreach ($_socials as $key => $item) {
         //do we have an id set ?
         //Typically not if the user still uses the old options value.
         //So, if the id is not present, let's build it base on the key, like when added to the collection in the customizer
         // Put them together
         printf('<li><a rel="nofollow" class="social-tooltip" %1$s title="%2$s" href="%3$s" %4$s style="color:%5$s"><i class="fa %6$s"></i></a></li>', !hu_is_customizing() ? '' : sprintf('data-model-id="%1$s"', !isset($item['id']) ? 'hu_socials_' . $key : $item['id']), isset($item['title']) ? esc_attr($item['title']) : '', isset($item['social-link']) && !empty($item['social-link']) ? esc_url($item['social-link']) : 'javascript:void(0)', isset($item['social-target']) && false != $item['social-target'] ? 'target="_blank"' : '', isset($item['social-color']) ? esc_attr($item['social-color']) : '#000', isset($item['social-icon']) ? esc_attr($item['social-icon']) : '');
     }
     echo '</ul>';
 }
示例#3
0
    bloginfo();
    ?>
 &copy; <?php 
    echo date('Y');
    ?>
. <?php 
    _e('All Rights Reserved.', 'hueman');
    ?>
</p>
              <?php 
}
?>
            </div><!--/#copyright-->

            <?php 
if (hu_is_checked('credit') || hu_is_customizing()) {
    ?>
              <div id="credit" style="<?php 
    echo !hu_is_checked('credit') ? 'display:none' : '';
    ?>
">
                <p><?php 
    _e('Powered by', 'hueman');
    ?>
 <a href="http://wordpress.org" target="_blank">WordPress</a>. <?php 
    _e('Theme by', 'hueman');
    ?>
 <a href="http://presscustomizr.com">Press Customizr</a>.</p>
              </div><!--/#credit-->
            <?php 
}
示例#4
0
 function hu_maybe_register_custom_widget_zones()
 {
     $customized = array();
     if (hu_is_customizing() && isset($_POST['customized'])) {
         $customized = json_decode(wp_unslash($_POST['customized']), true);
         if (isset($customized['hu_theme_options[sidebar-areas]'])) {
             $sidebars = $customized['hu_theme_options[sidebar-areas]'];
         } else {
             $sidebars = hu_get_option('sidebar-areas', array());
         }
     } else {
         $sidebars = hu_get_option('sidebar-areas', array());
     }
     //at this point we need smthg really clean
     if (!is_array($sidebars) || empty($sidebars)) {
         return;
     }
     $default_args = array('name' => '', 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>');
     $default_zones = hu_get_default_widget_zones();
     foreach ($sidebars as $sb) {
         if (!isset($sb['id']) || empty($sb['id'])) {
             return;
         }
         //is it a built-in one?
         //=> in this case it's been registered another way
         $_id = $sb['id'];
         if (isset($default_zones[$_id])) {
             continue;
         }
         $args = wp_parse_args(array('name' => isset($sb['title']) ? '' . esc_attr($sb['title']) . '' : '', 'id' => '' . esc_attr(strtolower($sb['id'])) . ''), $default_args);
         register_sidebar($args);
     }
     //for each
 }