Buddypress Conditional Tags in Theme Header
-
Please help create a few buddypress conditional tags to show the page header, tagline and breadcrumbs. Here are examples of my pages:
WordPress page with header, tagline and breadcrumbs – http://mygordonvale.com/community/activity
Buddypress page without – http://mygordonvale.com/activity
Header code:
<div id="pagetop">
<div class="container">
<h1>
<?php if (is_category()) single_cat_title();
elseif (is_tag()) single_tag_title();
elseif (is_day()) the_time('F jS, Y');
elseif (is_month()) the_time('F, Y');
elseif (is_year()) the_time('Y');
elseif (is_search()) the_search_query();
elseif (is_author()) {
global $wp_query;
$curauth = $wp_query->get_queried_object();
echo $curauth->nickname;
}
else the_title();
?>
</h1>
<?php include(TEMPLATEPATH . '/includes/postinfo.php'); ?>
</div> <!-- end .container -->
</div> <!-- end #pagetop -->Post Info (tagline)
<?php if (is_page() || is_category()) { ?>
<?php $tagline = get_post_meta($post->ID, 'Tagline', $single = true);
if (is_category()) $tagline = category_description();
if ($tagline <> '') { ?>
<p class="tagline">
<?php echo($tagline); ?>
</p>
<?php }; ?>
<?php } elseif (is_single() && get_option('thecorporation_postinfo2') <> '') { ?>
<p class="tagline">
<span><?php _e('Posted','TheCorporation'); ?> <?php if (in_array('author', get_option('thecorporation_postinfo2'))) { ?> <?php _e('by','TheCorporation'); ?> <?php the_author_posts_link(); ?><?php }; ?><?php if (in_array('date', get_option('thecorporation_postinfo2'))) { ?> <?php _e('on','TheCorporation'); ?> <?php the_time(get_option('thecorporation_date_format')) ?><?php }; ?><?php if (in_array('categories', get_option('thecorporation_postinfo2'))) { ?> <?php _e('in','TheCorporation'); ?> <?php the_category(', ') ?><?php }; ?><?php if (in_array('comments', get_option('thecorporation_postinfo2'))) { ?> | <?php comments_popup_link(__('0 comments','TheCorporation'), __('1 comment','TheCorporation'), '% '.__('comments','TheCorporation')); ?><?php }; ?></span>
</p>
<?php }; ?>Breadcrumbs – should I be using bp-breadcrumbs plugin
<div id="breadcrumbs">
<div class="container">
<?php if(function_exists('bcn_display')) { bcn_display(); }
else { ?>
<a href="<?php bloginfo('url'); ?>"><?php _e('Home','TheCorporation') ?></a> »
<?php if( is_tag() ) { ?>
<?php _e('Posts Tagged "','TheCorporation') ?><?php single_tag_title(); echo('"'); ?>
<?php } elseif (is_day()) { ?>
<?php _e('Posts made in','TheCorporation') ?> <?php the_time('F jS, Y'); ?>
<?php } elseif (is_month()) { ?>
<?php _e('Posts made in','TheCorporation') ?> <?php the_time('F, Y'); ?>
<?php } elseif (is_year()) { ?>
<?php _e('Posts made in','TheCorporation') ?> <?php the_time('Y'); ?>
<?php } elseif (is_search()) { ?>
<?php _e('Search results for','TheCorporation') ?> <?php the_search_query() ?>
<?php } elseif (is_single()) { ?>
<?php $category = get_the_category();
$catlink = get_category_link( $category[0]->cat_ID );
echo ('<a href="'.$catlink.'">'.$category[0]->cat_name.'</a> » '.get_the_title()); ?>
<?php } elseif (is_category()) { ?>
<?php single_cat_title(); ?>
<?php } elseif (is_author()) { ?>
<?php _e('Posts by ','TheCorporation'); echo ' ',$curauth->nickname; ?>
<?php } elseif (is_page()) { ?>
<?php wp_title(''); ?>
<?php }; ?>
<?php }; ?>
</div> <!-- end .container -->
</div> <!-- end #breadcrumbs -->
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Buddypress Conditional Tags in Theme Header’ is closed to new replies.