Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.
Open
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
25 changes: 8 additions & 17 deletions footer.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
<footer role="contentinfo">

<div id="inner-footer" class="clearfix">
<hr />
</div> <!-- end #container -->
<footer id="mainfooter" role="contentinfo">
<div id="inner-footer" class="container clearfix">
<div id="widget-footer" class="clearfix row">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer1') ) : ?>
<?php endif; ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer2') ) : ?>
<?php endif; ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('footer3') ) : ?>
<?php endif; ?>
<?php for ($i=1; $i <= get_theme_mod('footer_widget_areas'); $i++){ ?>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("footer$i") ) : ?>
<?php endif; ?>
<?php }?>
</div>

<nav class="clearfix">
<?php wp_bootstrap_footer_links(); // Adjust using Menus in Wordpress Admin ?>
</nav>

<p class="pull-right"><a href="http://320press.com" id="credit320" title="By the dudes of 320press">320press</a></p>

<p class="attribution">&copy; <?php bloginfo('name'); ?></p>

</div> <!-- end #inner-footer -->

</footer> <!-- end footer -->

</div> <!-- end #container -->


<!--[if lt IE 7 ]>
<script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
Expand Down
42 changes: 15 additions & 27 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
// Shortcodes
require_once('library/shortcodes.php');

// Customizations
require_once('library/customizations.php');

// Admin Functions (commented out by default)
// require_once('library/admin.php'); // custom admin functions

Expand Down Expand Up @@ -79,34 +82,18 @@ function wp_bootstrap_register_sidebars() {
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));

register_sidebar(array(
'id' => 'footer1',
'name' => 'Footer 1',
'before_widget' => '<div id="%1$s" class="widget col-sm-4 %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));

register_sidebar(array(
'id' => 'footer2',
'name' => 'Footer 2',
'before_widget' => '<div id="%1$s" class="widget col-sm-4 %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));

register_sidebar(array(
'id' => 'footer3',
'name' => 'Footer 3',
'before_widget' => '<div id="%1$s" class="widget col-sm-4 %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));

for ($i=1; $i <= get_theme_mod('footer_widget_areas'); $i++){
$cols = 12/get_theme_mod('footer_widget_areas');
register_sidebar(array(
'id' => "footer$i",
'name' => "Footer $i",
'before_widget' => '<div id="%1$s" class="widget col-sm-'.$cols.' %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
));
}

/*
to add more sidebars or widgetized areas, just copy
Expand Down Expand Up @@ -510,4 +497,5 @@ function wp_bootstrap_wp_title( $title, $sep ) {
}
add_filter( 'wp_title', 'wp_bootstrap_wp_title', 10, 2 );


?>
21 changes: 16 additions & 5 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<header role="banner">

<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar navbar-default <?php echo get_theme_mod('header_type');?>">
<div class="container">

<div class="navbar-header">
Expand All @@ -47,24 +47,35 @@
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" title="<?php echo get_bloginfo('description'); ?>" href="<?php echo home_url(); ?>"><?php bloginfo('name'); ?></a>
<a class="navbar-brand" title="<?php echo get_bloginfo('description'); ?>" href="<?php echo home_url(); ?>">
<?php if(get_theme_mod('logo')):?>
<img src="<?php echo get_theme_mod('logo'); ?>" alt="<?php bloginfo('name'); ?>"/>
<?php else:?>
<?php bloginfo('name'); ?>
<?php endif;?>
</a>
</div>

<div class="collapse navbar-collapse navbar-responsive-collapse">
<?php wp_bootstrap_main_nav(); // Adjust using Menus in Wordpress Admin ?>

<?php //if(of_get_option('search_bar', '1')) {?>
<?php if(get_theme_mod('show_search')) {?>
<form class="navbar-form navbar-right" role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<div class="form-group">
<input name="s" id="s" type="text" class="search-query form-control" autocomplete="off" placeholder="<?php _e('Search','wpbootstrap'); ?>" data-provide="typeahead" data-items="4" data-source='<?php echo $typeahead_data; ?>'>
</div>
</form>
<?php //} ?>
<?php } ?>
</div>

</div> <!-- end .container -->
</div> <!-- end .navbar -->

</header> <!-- end header -->

<div class="container">
<?php
$container_class = 'container';
if(get_post_type( get_the_ID() ) == 'page')
$container_class = get_post_meta( $post->ID, '_layout_width_meta', 'container' );
?>
<div class="<?php echo $container_class;?>">
2 changes: 1 addition & 1 deletion library/css/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,4 @@
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}
}
219 changes: 219 additions & 0 deletions library/customizations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
<?php

/************* LAYOUT META BOX *****************/

/**
* Adds a box to the side column on the Post and Page edit screens.
*/

function layout_width_add_meta_box() {

$screens = array( 'page' );

foreach ( $screens as $screen ) {

add_meta_box(
'layout_width_sectionid',
__( 'Layout Width', 'layout_width_textdomain' ),
'layout_width_meta_box_callback',
$screen,
'side'
);
}
}
add_action( 'add_meta_boxes', 'layout_width_add_meta_box' );


function layout_width_meta_box_callback( $post ) {

wp_nonce_field( 'layout_width_meta_box', 'layout_width_meta_box_nonce' );

$value = get_post_meta( $post->ID, '_layout_width_meta', true );

echo '<select id="layout_width_meta_field" name="layout_width_meta_field" value="' . esc_attr( $value ) . '">';
echo '<option '. (esc_attr( $value ) == 'container' ? 'selected' : '') .' value="container">Boxed</option>';
echo '<option '. (esc_attr( $value ) == 'container-full' ? 'selected' : '') .' value="container-full">100%</option>';
echo '</select>';
}


function layout_width_save_meta_box_data( $post_id ) {


if ( ! isset( $_POST['layout_width_meta_box_nonce'] ) ) {
return;
}

if ( ! wp_verify_nonce( $_POST['layout_width_meta_box_nonce'], 'layout_width_meta_box' ) ) {
return;
}

if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}

if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {

if ( ! current_user_can( 'edit_page', $post_id ) ) {
return;
}

} else {

if ( ! current_user_can( 'edit_post', $post_id ) ) {
return;
}
}

if ( ! isset( $_POST['layout_width_meta_field'] ) ) {
return;
}

$my_data = sanitize_text_field( $_POST['layout_width_meta_field'] );

update_post_meta( $post_id, '_layout_width_meta', $my_data );
}
add_action( 'save_post', 'layout_width_save_meta_box_data' );



function wp_bootstrap_customize_register( $wp_customize ) {

$wp_customize->add_section( 'wp_bootstrap_header_options',
array(
'title' => __( 'Header', 'wpbootstrap' ),
'priority' => 35,
'capability' => 'edit_theme_options',
)
);

$wp_customize->add_section( 'wp_bootstrap_footer_options',
array(
'title' => __( 'Footer', 'wpbootstrap' ),
'priority' => 36,
'capability' => 'edit_theme_options',
)
);

$wp_customize->add_setting( 'logo',
array(
'default' => '',
'type' => 'theme_mod',
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);

$wp_customize->add_control( new WP_Customize_Image_Control( //Instantiate the color control class
$wp_customize, //Pass the $wp_customize object (required)
'wp_bootstrap_logo', //Set a unique ID for the control
array(
'label' => __( 'Logo', 'wpbootstrap' ), //Admin-visible name of the control
'section' => 'wp_bootstrap_header_options', //ID of the section this control should render in (can be one of yours, or a WordPress default section)
'settings' => 'logo', //Which setting to load and manipulate (serialized is okay)
'priority' => 10, //Determines the order this control appears in for the specified section
)
) );

$wp_customize->add_setting( 'header_type',
array(
'default' => 'navbar-fixed-top',
'type' => 'theme_mod',
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);

$wp_customize->add_control( 'wp_bootstrap_header_type',
array(
'label' => __( 'Header Type', 'wpbootstrap' ),
'section' => 'wp_bootstrap_header_options',
'settings' => 'header_type',
'type' => 'radio',
'default' => 'navbar-fixed-top',
'choices' => array(
'navbar-fixed-top' => 'Fixed',
'navbar-static-top' => 'Static',
),
)
);

$wp_customize->add_setting( 'body_padding_top',
array(
'default' => '60px',
'type' => 'theme_mod',
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);

$wp_customize->add_control( 'wp_bootstrap_body_padding_top',
array(
'label' => __( 'Body Padding Top (use with fixed header)', 'wpbootstrap' ),
'section' => 'wp_bootstrap_header_options',
'settings' => 'body_padding_top',
'type' => 'text',
'default' => '60px',
)
);

$wp_customize->add_setting( 'show_search',
array(
'default' => true,
'type' => 'theme_mod',
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);

$wp_customize->add_control( 'wp_bootstrap_show_search',
array(
'label' => __( 'Show Search Bar', 'wpbootstrap' ),
'section' => 'wp_bootstrap_header_options',
'settings' => 'show_search',
'type' => 'checkbox',
'default' => true,
)
);


$wp_customize->add_setting( 'footer_widget_areas',
array(
'default' => 3,
'type' => 'theme_mod',
'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting.
'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
)
);

$wp_customize->add_control( 'wp_bootstrap_footer_widget_areas',
array(
'label' => __( 'Footer Widget Areas', 'wpbootstrap' ),
'section' => 'wp_bootstrap_footer_options',
'settings' => 'footer_widget_areas',
'type' => 'select',
'default' => 3,
'choices' => array(
1=>1, 2=>2, 3=>3, 4=>4, 6=>6
),
)
);
}

add_action( 'customize_register', 'wp_bootstrap_customize_register' );

function wp_bootstrap_customize_css()
{
?>
<style type="text/css">
<?php if(get_theme_mod('header_type') == 'navbar-fixed-top'):?>
body { padding-top:<?php echo get_theme_mod('body_padding_top'); ?>; }
<?php else:?>
body { padding-top:0px; }
<?php endif;?>
</style>
<?php
}
add_action( 'wp_head', 'wp_bootstrap_customize_css');

?>
4 changes: 4 additions & 0 deletions library/less/wp.less
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ input, textarea, select, .uneditable-input {
margin-left: 10px;
}

.container-full{
overflow: hidden;
}

/* navbar */

ul.nav {
Expand Down
Loading