Web Design Forum: WP sidebars issues - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

WP sidebars issues Rate Topic: -----

#1 User is offline   Ash Scott 

  • Competition Manager
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,416
  • Joined: 25-May 10
  • Reputation: 53
  • Gender:Male
  • Location:Kent
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 01 February 2012 - 10:06 AM

Hi there, I am codin a theme, using Blankslate as the foundations, but the sidebars not working :(

functions.php
<?php
load_theme_textdomain( 'blankslate', TEMPLATEPATH . '/languages' );
$locale = get_locale();
$locale_file = TEMPLATEPATH . "/languages/$locale.php";
if ( is_readable($locale_file) )
require_once($locale_file);
function blankslate_get_page_number() {
if (get_query_var('paged')) {
print ' | ' . __( 'Page ' , 'blankslate') . get_query_var('paged');
}
}
add_action( 'after_setup_theme', 'blankslate_theme_setup' );
function blankslate_theme_setup() {
add_theme_support( 'automatic-feed-links' );
}
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
if ( ! isset( $content_width ) ) $content_width = 640;
add_filter('the_title', 'blankslate_title');
function blankslate_title($title) {
if ($title == '') {
return 'Untitled';
} else {
return $title;
}
}
function blankslate_register_menus() {
register_nav_menus(
array( 'main-menu' => __( 'Main Menu', 'blankslate' ))
);
}
add_action( 'init', 'blankslate_register_menus' );
function blankslate_theme_widgets_init() {
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>',
) );
}
add_action( 'init', 'blankslate_theme_widgets_init' );
$preset_widgets = array (
'primary-aside'  => array( 'search', 'pages', 'categories', 'archives' ),
);
if ( isset( $_GET['activated'] ) ) {
update_option( 'sidebars_widgets', $preset_widgets );
}
function blankslate_cats($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 ));
}
function blankslate_tags($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 ));
}
function blankslate_commenter_link() {
$commenter = get_comment_author_link();
if ( ereg( '<a[^>]* class=[^>]+>', $commenter ) ) {
$commenter = preg_replace( '/(<a[^>]* class=[\'"]?)/', '\\1url ' , $commenter );
} else {
$commenter = preg_replace( '/(<a )/', '\\1class="url "' , $commenter );
}
$avatar_email = get_comment_author_email();
$avatar = str_replace( "class='avatar", "class='photo avatar", get_avatar( $avatar_email, 80 ) );
echo $avatar . ' <span class="fn n">' . $commenter . '</span>';
}
function blankslate_custom_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
$GLOBALS['comment_depth'] = $depth;
?>
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
<div class="comment-author vcard"><?php blankslate_commenter_link() ?></div>
<div class="comment-meta"><?php printf(__('Posted %1$s at %2$s <span class="meta-sep"> | </span> <a href="%3$s" title="Permalink to this comment">Permalink</a>', 'blankslate'),
get_comment_date(),
get_comment_time(),
'#comment-' . get_comment_ID() );
edit_comment_link(__('Edit', 'blankslate'), ' <span class="meta-sep"> | </span> <span class="edit-link">', '</span>'); ?></div>
<?php if ($comment->comment_approved == '0') _e("\t\t\t\t\t<span class='unapproved'>Your comment is awaiting moderation.</span>\n", 'blankslate') ?>
<div class="comment-content">
<?php comment_text() ?>
</div>
<?php
if($args['type'] == 'all' || get_comment_type() == 'comment') :
comment_reply_link(array_merge($args, array(
'reply_text' => __('Reply','blankslate'),
'login_text' => __('Log in to reply.','blankslate'),
'depth' => $depth,
'before' => '<div class="comment-reply-link">',
'after' => '</div>'
)));
endif;
?>
<?php }
function blankslate_custom_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
?>
<li id="comment-<?php comment_ID() ?>" <?php comment_class() ?>>
<div class="comment-author"><?php printf(__('By %1$s on %2$s at %3$s', 'blankslate'),
get_comment_author_link(),
get_comment_date(),
get_comment_time() );
edit_comment_link(__('Edit', 'blankslate'), ' <span class="meta-sep"> | </span> <span class="edit-link">', '</span>'); ?></div>
<?php if ($comment->comment_approved == '0') _e('\t\t\t\t\t<span class="unapproved">Your trackback is awaiting moderation.</span>\n', 'blankslate') ?>
<div class="comment-content">
<?php comment_text() ?>
</div>
<?php }


sidebar.php
<div id="sidebar">
<?php if ( is_active_sidebar('primary-widget-area') ) : ?>
<div id="primary" class="widget-area">
<ul class="sid">
<?php dynamic_sidebar('primary-widget-area'); ?>
</ul>
</div>
<?php endif; ?>
</div>


<?php get_sidebar(); ?>


why is my sidebar not displaying? :(

fragtalk.org

I'm also tring to get a second sidebar, so i have one either side, both 250px wide, but i have tried loads of tutorials and none worked :(

Regards
Ash
0

#2 User is online   MikeChipshop 

  • Small but imperfectly formed
  • Group: Moderators
  • Posts: 7,045
  • Joined: 19-April 10
  • Reputation: 503
  • Gender:Male
  • Location:Scotland

Posted 01 February 2012 - 10:58 AM

Try...

<?php get_sidebar(primary-widget-area); ?>


Also, as far as i can see due to the functions.php file not being laid out to well, you seem to have only registered one sidebar? Maybe i just haven't spotted the second one.
0

#3 User is offline   Ash Scott 

  • Competition Manager
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,416
  • Joined: 25-May 10
  • Reputation: 53
  • Gender:Male
  • Location:Kent
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 01 February 2012 - 01:01 PM

I decided to use a new theme, and it now works, apart from the second sidebar >:(
0

#4 User is online   MikeChipshop 

  • Small but imperfectly formed
  • Group: Moderators
  • Posts: 7,045
  • Joined: 19-April 10
  • Reputation: 503
  • Gender:Male
  • Location:Scotland

Posted 01 February 2012 - 01:02 PM

Are you registering both sidebars in the functions file?
0

#5 User is offline   Ash Scott 

  • Competition Manager
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,416
  • Joined: 25-May 10
  • Reputation: 53
  • Gender:Male
  • Location:Kent
  • Experience:Advanced
  • Area of Expertise:Designer/Coder

Posted 01 February 2012 - 01:18 PM

its done now, thanks anyway :D if you could be so kind to help me with one small issue? the nav >:( I have aset the <a> in the <li> to block, so i could use a bg image for the links. This isnt working on this theme, but was on the other.. Tried putting the image elsewhere, linked correctly too.

fragtalk.org

edit: its weird too, cos the hover works but the a:link seems to have no effect

This post has been edited by Ash Scott: 01 February 2012 - 01:31 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users