Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My site has a static landing page with buttons to go to Cait's content or Shannons's content. Each author's page will feature their own posts, as well as a section with their social media streams. It is vital that these two author's content is kept separate. Currently, I'm using conditional tags in the header to take care of this but I've ended up with nothing but blank author pages. Any ideas how I can rectify?

header.php-

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    <meta name="generator" content="Wordpress <?php bloginfo('version'); ?>" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
    <link rel="pingback" href="<?php bloginfo('pingback url'); ?>" />
    <link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" />
    <link rel="shortcut icon" href="<?php bloginfo('stylesheet_directory'); ?>/favicon.ico" />
    <?php wp_head(); ?>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

</head>

<body>
<div id="container">
    <div id="header">
        <div class="logo">
            <h1><img src="img/caitlogo.png" alt="cait barker logo" /></h1>
        </div><!-- end logo -->
        <nav>
            <ul>
                <li><a href="#">outfit of the day</a></li>
                <li><a href="#">vlog</a></li>
                <li><a href="#">features</a></li>
                <li><a href="#">diy</a></li>
                <li><a href="#">contact</a></li>
            </ul>
        </nav><!-- end nav -->
        <div class="social">
            <ul>
                <li><a href="http://web.stagram.com/n/caitbarkerr/"><img src="img/instagram.png" alt="cait barker instagram" /></a></li>
                <li><a href="http://www.youtube.com/user/caitbarker"><img src="img/youtube.png" alt="cait barker youtube" /></a></li>
                <li><a href="http://www.facebook.com/CaitShannonBarker"><img src="img/facebook.png" alt="cait barker facebook" /></a></li>
                <li><a href="https://twitter.com/caitbarkerr"><img src="img/twitter.png" alt="cait barker twitter" /></a></li>
                <li><a href="#"><img src="img/pinterest.png" alt="cait barker pinterest" /></a></li>
            </ul>
        </div><!-- end social -->
    </div><!-- end header -->

    <div id="streams">
        <div class="vlog-stream">
            <?php
                if (is_author(cait barker)) {
                echo do_shortcode("[ix_show_latest_yt ytid='caitbarker' width='280' height='170' autoplay='off' count_of_videos='1']");
                }
                if (is_author(shannon barker)) {
                echo do_shortcode("[ix_show_latest_yt ytid='shannonbarkerr' width='280' height='170' autoplay='off' count_of_videos='1']");
                }
            ?>
            <p>vlog</p>
        </div><!-- end vlog-stream -->
        <div class="ootd-stream">
            <?php
                if (is_author(cait barker)) {
                $new_query = new WP_Query( 'cat=your_category_id&showposts=2' );
                if( $new_query->have_posts() ): while( $new_query->have_posts ): $new_query->the_post();

                the_post_thumbnail();

                endwhile;
                endif;
                wp_reset_query();
                ]
                if (is_author(shannon barker)) {
                $new_query = new WP_Query( 'cat=your_category_id&showposts=10' );
                if( $new_query->have_posts() ): while( $new_query->have_posts ): $new_query->the_post();

                the_post_thumbnail();

                endwhile;
                endif;
                wp_reset_query();
                ]
            ?>
            <p>outfit of the day</p>
        </div><!-- end ootd-stream -->
        <div class="insta-stream">
            <?php
                if (is_author(cait barker)) {
                echo do_shortcode("[instapress userid='caitbarkerr' piccount='6' size='73px']");
                ]
                if (is_author(shannon barker)) {
                echo do_shortcode("[instapress userid='shannonbarkerr' piccount='6' size='73px']");
                ]
            ?> 
            <p>instagram</p>
        </div><!-- end insta-stream -->
    </div><!-- end streams -->

index.php-

<?php echo get_header();;?>
<?php
    if (is_author(cait barker)) {
    echo get_sidebar('cait');;
    }
    if (is_author(shannon barker)) {
    echo get_sidebar('shannon');;
    }
?>


<div id="blog">
    <div class="preview">
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <div class="post-image">
            <?php echo ravs_get_custom_image( get_post_thumbnail_id () ); ?>
        </div><!-- end post-image -->
        <div class="post">
            <h2><?php the_title() ;?></h2>
            <span class="post-preview">
                <?php the_excerpt('read more...'); ?>
                <?php endwhile; else: ?>

                    <p>Sorry, no posts to list</p>

                <?php endif; ?>
            </span><!-- end post-preivew -->
            <p class="post-meta"><span style="font-family: amatic;">>></span>&nbsp;Posted on <?php the_date('M-d-y'); ?>&nbsp;<span style="font-family: amatic;">>></span>&nbsp;<?php the_tags('tags: ', ', ', '<br />'); ?></p><!-- end post-meta -->
        </div><!-- end post -->
    </div><!-- end preview -->
</div><!-- end blog -->


<?php get_footer(); ?>
share|improve this question

2 Answers 2

up vote 1 down vote accepted
+50

As i see your code in header.php and index.php looking messy (because of many if conditions). If i'm understanding your problem then i do it like this

  1. create separate author.php for both authors their name like author-cait.php and author-shannons.php
  2. Give link like http://www.yousite.com/author/cait/ to button on static landing page.When user click on this,it takes him to author's specific author.php if exist
  3. create custom header.php for both authors name like header-cait.php and header-shannons.php
  4. create custom sidebar.php for both authors name like sidebar-cait.php and sidebar-shannons.php
  5. complete your code in author specific author.php for example author-cait.php contain only cait's conditon,header and sidebar.

It makes your code looking beatiful,manageable, save from overloding of if conditions.

share|improve this answer
    
thank you for the step-by-step answer. –  user1255049 May 29 '13 at 20:38
    
Glad to be of help.This is my fist Bounty –  Ravs May 29 '13 at 20:52

You don't declare two post index pages, not any way that I am aware of anyway. And if there is a way, I still think what follows is the better solution, given your other conditions.

I guess you could hook to template_redirect and load different templates based on the author but the neater solution, and the one I'd recommend, would be to create a new post type for each author. Each type, and hence each author, would have its own index page and you could use the built in templating system to format the pages.

The two authors could share tags and categories, you could create new taxonomies for each author and keep those separated, or do both-- share some and keep others distinct.

You could also create sidebars specific to the post type, and hence specific to the authors.

I think that covers the issues you mentioned.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.