Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------SIDEBAR.PHP---------------------------------------------
- <div id="linkwrap">
- <?php if ( is_sidebar_active('primary_widget_area') ) : ?>
- <div id="primary" class="widget-area">
- <ul class="xoxo">
- <?php dynamic_sidebar('primary_widget_area'); ?>
- </ul>
- </div><!-- #primary .widget-area -->
- <?php endif; ?>
- <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?>
- <?php dynamic_sidebar( 'sidebar-1' ); ?>
- <?php endif; ?>
- <?php if ( !function_exists('dynamic_sidebar')
- || !dynamic_sidebar() ) : ?>
- <?php endif; ?>
- </div>
- ---------------------------------------------FUNCTIONS.PHP---------------------------------------------
- <?php
- // Make theme available for translation
- // Translations can be filed in the /languages/ directory
- load_theme_textdomain( 'your-theme', TEMPLATEPATH . '/languages' );
- $locale = get_locale();
- $locale_file = TEMPLATEPATH . "/languages/$locale.php";
- if ( is_readable($locale_file) )
- require_once($locale_file);
- // Get the page number
- function get_page_number() {
- if (get_query_var('paged')) {
- print ' | ' . __( 'Page ' , 'your-theme') . get_query_var('paged');
- }
- } // end get_page_number
- // For category lists on category archives: Returns other categories except the current one (redundant)
- function quickchic_widgets_init() {
- register_sidebar(array(
- 'name' => __( 'Sidebar 1', 'quickchic' ),
- 'id' => 'sidebar-1',
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- }
- add_action( 'init', 'quickchic_widgets_init' );
- function cats_meow($glue) {
- $current_cat = single_cat_title( '', false );
- $separator = "\n";
- $cats = explode( $separator, get_the_category_list($separator) );
- foreach ( $cats as $i => $str ) {
- if ( strstr( $str, ">$current_cat<" ) ) {
- unset($cats[$i]);
- break;
- }
- }
- if ( empty($cats) )
- return false;
- return trim(join( $glue, $cats ));
- } // end cats_meow
- // For tag lists on tag archives: Returns other tags except the current one (redundant)
- function tag_ur_it($glue) {
- $current_tag = single_tag_title( '', '', false );
- $separator = "\n";
- $tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) );
- foreach ( $tags as $i => $str ) {
- if ( strstr( $str, ">$current_tag<" ) ) {
- unset($tags[$i]);
- break;
- }
- }
- if ( empty($tags) )
- return false;
- return trim(join( $glue, $tags ));
- } // end tag_ur_it
- // Register widgetized areas
- function theme_widgets_init() {
- // Area 1
- register_sidebar( array (
- 'name' => 'Primary Widget Area',
- 'id' => 'primary_widget_area',
- 'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
- 'after_widget' => "</li>",
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- } // end theme_widgets_init
- add_action( 'init', 'theme_widgets_init' );
- // Pre-set Widgets
- $preset_widgets = array (
- 'primary_widget_area' => array( 'search', 'pages', 'categories', 'archives' ),
- 'secondary_widget_area' => array( 'links', 'meta' )
- );
- if ( !isset( $_GET['activated'] ) ) {
- update_option( 'sidebars_widgets', $preset_widgets );
- }
- // update_option( 'sidebars_widgets', NULL );
- // Check for static widgets in widget-ready areas
- function is_sidebar_active( $index ){
- global $wp_registered_sidebars;
- $widgetcolums = wp_get_sidebars_widgets();
- if ($widgetcolums[$index]) return true;
- return false;
- } // end is_sidebar_active
- -------------------------------------PAGE.PHP---------------------------------------------
- ...
- </div>
- <?php get_sidebar(); ?>
- <div id="textwrap">
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement