Skip to content
This repository has been archived by the owner. It is now read-only.

Widgets area changes #14

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions css/widgets-area.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
$absolute_path = explode('wp-content', $_SERVER['SCRIPT_FILENAME']);
$wp_load = $absolute_path[0] . 'wp-load.php';
require_once($wp_load);

header("Content-type: text/css; charset: UTF-8");
header('Cache-control: must-revalidate');

$sidebars = wp_get_sidebars_widgets();
$index = 0;
for ($i=1; $i < 31 ; $i++) {
if( !empty($sidebars['home'.$i]) ){
if( $i > $index ){
$index = $i; //$index is the biggest home widget area that has widgets, the next widget area doesn't have widgets
}
}
}
$start = ++$index;
for ($i=$start; $i < 31; $i++) {
echo '#home'.$i.'{ display:none; } ';
}
?>
4 changes: 2 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @package cornerstone
*/
?>
</div><!-- #page -->

</div><!-- .container-->
</div><!-- #content -->
<div id="footers">
Expand Down Expand Up @@ -71,7 +71,7 @@
</ul>
</div>
</footer>
</div>
</div><!-- #footers -->
</div><!-- #page -->

<?php wp_footer(); ?>
Expand Down
75 changes: 54 additions & 21 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,28 +172,61 @@ function be_hidden_meta_boxes($hidden, $screen) {
}


function load_custom_wp_admin_style() {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' );
wp_enqueue_style( 'custom_wp_admin_css' );


wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js', false, '1.0.0');
wp_enqueue_script('uc-admin-js');
function load_custom_wp_admin_style($hook) {
wp_register_style( 'custom_wp_admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' );
wp_enqueue_style( 'custom_wp_admin_css' );


wp_register_script('uc-admin-js', get_template_directory_uri() . '/js/admin-style.js', false, '1.0.0');
wp_enqueue_script('uc-admin-js');

if( 'widgets.php' != $hook )
return;
wp_register_style( 'css-widgets-area', get_template_directory_uri().'/css/widgets-area.php' );
wp_enqueue_style( 'css-widgets-area' );
}
add_action( 'admin_enqueue_scripts', 'load_custom_wp_admin_style' );

/*
function remove_widgets() {
// removed to avoid confusion with UConn Calendar widget
unregister_widget('WP_Widget_Calendar');
// removed to de-emphasize blog use
unregister_widget('WP_Widget_Recent_Comments');
unregister_widget('WP_Widget_Meta');
// removed for conflict with simple social plugin on IE9
unregister_widget('WP_Widget_Categories');

add_theme_support( 'post-thumbnails' );

//Bootstrap whitelist
function add_allowed_tags($tags) {
$newtags = array(
'div',
'ul',
'li',
'button',
'a');
$newattrs = array(
'data-toggle' => true,
'data-dismiss' => true,
'data-target' => true,
'data-spy' => true,
'data-loading-text' => true,
'data-parent' => true,
'data-slide' => true,
'data-slide-to' => true,
'data-provide' => true,
'data-interval' => true,
'data-pause' => true,
'data-animation' => true,
'data-html' => true,
'data-placement' => true,
'data-selector' => true,
'data-title' => true,
'data-trigger' => true,
'data-delay' => true,
'data-container' => true);

foreach($newtags as $newtag){
if( isset($tags[$newtag]) && is_array($tags[$newtag])){
$tags[$newtag] = array_merge($tags[$newtag], $newattrs);
}
else{
$tags[$newtag] = $newattrs;
}
}

return $tags;
}
add_action( 'widgets_init', 'remove_widgets' );
*/

add_theme_support( 'post-thumbnails' );
add_filter('wp_kses_allowed_html', 'add_allowed_tags');
4 changes: 2 additions & 2 deletions inc/reg-sidebars.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
*/
function uc_options_add_page() {
add_theme_page( 'Manage Sidebars', 'Manage Sidebars', 'edit_theme_options', 'uc_sidebars', 'uc_sidebars_do_page' );
remove_submenu_page( 'themes.php', 'widgets.php' );
//remove_submenu_page( 'themes.php', 'widgets.php' );
}
add_action( 'admin_menu', 'uc_options_add_page' );

Expand Down Expand Up @@ -148,7 +148,7 @@ function custom_searchform($form){
}
$search_counter++;

$form = '<div class="searchform"><form action="'.home_url( '/' ).'" method="get" class="form-inline" role="form"><div class="form-group"><fieldset>';
$form = '<div class="searchform"><form action="'.home_url( '/' ).'" method="get" class="form-inline" role="form"><div class="form-group"><fieldset><legend class="sr-only">Search this Site</legend>';
$form .= '<label for="searchfield-'.$search_counter.'" class="sr-only">Search in '.home_url( '/' ).'></label>';
$form .= '<input type="text" name="s" id="searchfield-'.$search_counter.'" value="'.get_search_query().'" class="form-control search" placeholder="Search '.get_bloginfo("name").'... " />';
$form .= '<button type="submit" class="btn btn-default" title="Search"><i class="glyphicon glyphicon-search"></i><span class="sr-only">Search</span></button>';
Expand Down
2 changes: 1 addition & 1 deletion inc/submenu-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
<?php include('sidemenu-walker.php')?>
</nav>
</div>
<div class="col-sm-9">
<div class="col-sm-8 col-sm-offset-1">
<?php } /* end checkMenu */?>
10 changes: 9 additions & 1 deletion js/admin-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,12 @@ jQuery(document).ready(function($) {
$('#accordion-section-layout_builder .ui-slider-handle').each(function(){
$(this).addClass('button button-primary');
});
});

var path = window.location.pathname;
if( path.split('/').indexOf('widgets.php') != -1 ){
$('.widgets-holder-wrap.sidebar-sidebar').each(function(i){
if( !($(this['children'][0]).is(":visible")) ){
$(this).css('display', 'none');
}
});
}
21 changes: 12 additions & 9 deletions js/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,16 +215,19 @@ jQuery(document).ready(function($) {

function stickyFoot(){
/* Andrew's Sticky Footer JS. */
var wrapperH = document.getElementById('page').clientHeight;
var footerH = document.getElementById('footers').clientHeight

var comboH = wrapperH + footerH;
var windowH = window.innerHeight;
if(windowH>=comboH){
$('body').addClass('sticky')
} else {
$('body').removeClass('sticky')

if (document.getElementById('page')!=null && document.getElementById('footers') !=null){
var wrapperH = document.getElementById('page').clientHeight;
var footerH = document.getElementById('footers').clientHeight
var windowH = window.innerHeight;
if(windowH>=wrapperH){
$('body').addClass('sticky')
} else {
$('body').removeClass('sticky')
}
}


}
window.onload = function (){
placeholderSupport = ("placeholder" in document.createElement("input"));
Expand Down
1 change: 1 addition & 0 deletions js/min/admin-style.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/min/cs.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/min/navigation.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 34 additions & 1 deletion js/navigation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
/**
* navigation.js
*
*/

jQuery(document).ready(function($) {

function replaceAnchors(selector) {
$(selector).each(function(){
var atag = $(this).children('a');
var newhref = getFirstLink(this);
atag.attr('href',newhref);
});
}
function getFirstLink(element){
var href = $(element).children('a').attr('href');
if(href == '#'){
var firstChild = $(element).children('ul').children('li').first();
if(firstChild.length == 0){
return href;
}
else {
return getFirstLink(firstChild);
}
}
else {
return href;
}
}

replaceAnchors('.menu-item-has-children');

});

/*
* Handles toggling the navigation menu for small screens.
*/
*
( function() {
var container, button, menu;
Expand Down Expand Up @@ -32,3 +64,4 @@
container.className += ' toggled';
};
} )();
*/
45 changes: 21 additions & 24 deletions page-home.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,29 @@
$rows = get_theme_mod('homepagerows');
$count = 1;
get_header(); ?>

<div id="page-home">
<?php while ( have_posts() ) : the_post(); ?>

<?php for($i=0; $i<$rows; $i++){ /* Begin Homepage Builder... */?>
<div class="row">

<?php
$widths = get_theme_mod('homepage_'.$i);
$widths = explode(',',$widths);
foreach($widths as $width){
if($width == 0) break;
?>
<div class="col-sm-<?php echo $width; ?>">
<div class="home-section" id="home-section-<?php echo $count; ?>">
<?php if ( is_active_sidebar( 'home'.$count ) ) { ?>
<?php dynamic_sidebar( 'home'.$count ); ?>
<?php } else { ?>

<?php }; ?>
</div>
</div>
<?php $count ++; } ?>

</div><!-- /row-->
<?php } /* ... end Homepage Builder */?>

<?php for($i=0; $i<$rows; $i++){ /* Begin Homepage Builder... */?>
<div class="row">
<?php
$widths = get_theme_mod('homepage_'.$i);
$widths = explode(',',$widths);
foreach($widths as $width){
if($width == 0) break;
?>
<div class="col-sm-<?php echo $width; ?>">
<div class="home-section" id="home-section-<?php echo $count; ?>">
<?php if ( is_active_sidebar( 'home'.$count ) ) { ?>
<?php dynamic_sidebar( 'home'.$count ); ?>
<?php } else { ?>
<?php }; ?>
</div>
</div>
<?php $count ++; } ?>
</div>
<!-- /row-->
<?php } /* ... end Homepage Builder */?>
<?php endwhile; // end of the loop. ?>
</div>
<?php get_footer(); ?>
2 changes: 1 addition & 1 deletion page.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<?php include('inc/sidebar-check.php')?>
<div id="page-page">
<?php while ( have_posts() ) : the_post(); ?>
<?php include('inc/submenu-check.php')?>
<?php include('inc/submenu-check.php') ?>
<div class="row">
<div class="col-sm-<?php echo (is_active_sidebar( $sidebar )?9:12); ?>">
<div id="primary" class="content-area">
Expand Down