How to Add a Stream Page to Your Site in 30 Seconds

This tutorial has been written for sites powered by the Genesis Framework. Certain parts of the code below will not work on other WordPress themes.

If you’re anything like me, you have random thoughts that you’d like to share with your readers. Chances are you don’t want comments or for them to go out in your RSS feed.

Well I have good news for you — creating a Stream page like mine is so incredibly simple that you can pull it off in 30 seconds. So now you can have your own personal Twitter.

Creating Your Stream Page

The first step is to place the code below into your child theme’s functions.php file:

/** Create stream custom post type */
add_action( 'init', 'stream_post_type' );
function stream_post_type() {
    register_post_type( 'stream',
        array(
            'labels' => array(
                'name' => __( 'Stream' ),
                'singular_name' => __( 'Stream' ),
            ),
            'has_archive' => true,
            'hierarchical' => true,
            'public' => true,
            'rewrite' => array( 'slug' => 'stream' ),
            'supports' => array( 'title', 'editor', 'custom-fields', 'genesis-seo', 'thumbnail' ),
        )
    );
}

Be sure to save your permalinks once you’ve added this code. Go to the Settings > Permalinks page in your WordPress dashboard and click the “save changes” button.

The next step is to create a archive-stream.php file and place it into your child theme folder. Inside that file place the following code:

<?php

/** Remove the Genesis post content and replace with WordPress */
remove_action( 'genesis_post_content', 'genesis_do_post_content' );
add_action( 'genesis_post_content', 'the_content' );

/** Remove the post title */
remove_action( 'genesis_post_title', 'genesis_do_post_title' );

/** Relocate the post info function */
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
add_action( 'genesis_after_post_content', 'genesis_post_info' );

/** Remove the post meta function */
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );

genesis();

Styling Your Stream Entries

If you want to style the entries of your stream, here is some sample CSS you can use:

.post-type-archive-stream .hentry {
    border-bottom: 1px dotted #ddd;
    margin: 0 0 25px;
}

.post-type-archive-stream .post-info {
    color: #999;
    font-size: 12px;
    margin: 0 0 25px;
    text-transform: uppercase;
}

Go to the Stream > Add New section inside your WordPress dashboard to publish your stream entires. Then you can access your stream at the /stream/ page on your website.

Email Newsletter

Like what you read here in this blog post?
Get more like it delivered to your inbox daily.

Comments

    • says

      I’ve wanted to use post formats for this, as Jason pointed out, but realized it was easier to just pull off this way. Of course there are a number of ways someone can do this, but I’ve simply written how I chose to.

    • says

      I’m going through a custom post type phase where I have a number of them being used here on my site. It’s just fun to field a way to drop “asides” on my site for people to see without having to update every social media platform with them.

  1. says

    Thanks, Brian.

    Did the code work. Can’t seem to find out how to write and publish my stream to the stream page. I assume I am to write a new blog post…. Any help would be great.

  2. says

    Brian,

    Your blog – and the stream page – are looking great.

    Two questions:

    Is it necessary to place the stream on a separate page?

    I take your point about not wanting these posts in feeds. We’ve got licenses for every Genesis theme which supports post formats, sandboxing them so we can switch one or more sites to Genesis. Would it be possible to put control of whether a post format is part of the feed in the theme settings, or is that an enormous coding burden?

    Jon

    • says

      Hey Jon, answers below:

      1. No it’s not, but for my use I wanted to have just one page where I house them.

      2. Yes, you could technically do this as “posts” with an aside post format. If you do that, best to create a “stream” category, and then exclude that category from your blog feed.

  3. says

    Wow,
    I didn’t realize that it was that simple, custom post types… I keep seeing more and more how powerful CPTs are. I do have a question though, If I have mulitple CPTs running at once, would it be easier to make a “cpt.php” file and put all the code in their, and then include( ) or require( ) it into the functions.php for efficiencies sake?

    • says

      If you do, I’m guessing you’ll have to make it an archive.php file, so that it’ll work that way. Because I customize some of my custom post type archive pages (for example) it was easier for me to just create separate archive-X.php files.

      • says

        Hmm!! Then what could be the SEO effect on the site. If we have plenty of such posts? Each post will have very less content (only a small paragraph).

        Sorry for being off-topic (more or less)

        I think it will be better to index only example.com/stream/ and block all posts of the stream (like example.com/stream/post-slug). What you think??

  4. says

    Hi Brian,

    this is a great idea.

    Like some of the previous posters I instantly though of “asides”.

    I would want to put them in the sidebar or footer as well I think.

    Hmmmm, I guess I could simply add a function to the functions file instead of (or in addition to) the page template and set that up so it would place the entries at the top of the sidebar for example.

    Or one could turn this into a widget, but that is still beyond me I’ afraid…

    Cheers,

    Jan

  5. says

    Brian, Thank you for sharing the code for this “tool”.

    Two Q’s:

    (1) The Post Meta was showing up, so in the Archive-Stream.php file I changed

    add_action( ‘genesis_after_post_content’, ‘genesis_post_info’ );
    to
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );

    Will that cause any problems? (It seems to be working fine.)

    (2) The code to style the entries of the stream don’t seem to be showing. Particularly the dotted line under each Stream item. I would appreciate any thoughts or suggestions on this.

    Thank you for sharing your tips and tricks! – Theresa :)

    • says

      Hey Theresa:

      1. Thanks, I actually just put the remove post meta code into the tutorial – if it’s working fine for you, should be good to go.

      2. Can you link me to the page? You might have to do a hard refresh to clear your browser cache.

  6. says

    Thank you for your reply.

    (1) I saw the updated archive-stream.php. Is it “cleaner” to have the

    /** Remove the post info function */
    and the
    /** Remove the post meta function */

    separate, for example this is what I currently have in that file…

    /** Remove the post info function */
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );

    (2) Sorry, I don’t know what a “hard refresh” is. I have been having a little issue where changes are sometimes not reflected for a day.

    I tried removing the cookies and the cache (I’m using Firefox 15.0.1), no changes yet. (This is my “test” site where I prep before I launch.)

    Thank you again for your reply – Theresa :)

  7. says

    Thank you for doing so many posts on custom post types. I just did my first one a couple of weeks ago, and your posts have really helped me see how to use the genesis hooks to save coding. :) And because I looked at your stream today I saw your page listing Google Fonts. Thanks again for the insight!

  8. Nigel says

    Hi Brian, thanks for your hard work… It IS appreciated!
    Just a question on setting the page width. I am using this in education child theme and the default page is 3 column, which is how the ‘Stream’ has defaulted to. Can I make the stream page full width?

      • Nigel says

        Doh! Of course. Thanks Brian, I ended up using this for the 2 column layout, in case anyone has a similiar question:
        add_filter( ‘genesis_pre_get_option_site_layout’, ‘__genesis_return_content_sidebar’ );

  9. says

    Awesome stuff. I’m working on a site these would be perfect for, actually.

    Quick question, though – what would I need to add back to the code that would allow me to add a title back into it? I see you have them on the top portion of your pages, but in a standard theme (News), how can I get that part back?

  10. says

    Thanks Brian.
    I just implemented on my blog. Styled it to look perfect.

    I have a question, like in your stream page there’s a title saying “What’s On My Mind”. That’s good thing so that viewer can understand what is it. I would like to do same with my theme, but only for my stream page, I know it is “Theme” based but can you give me hint how can I add a title to stream page, that’ll be awesome.

    Thanks again. :)
    -Aditya

      • says

        Inside the child theme’s page-title.php file, add this code in the conditionals:

        elseif ( is_post_type_archive( 'stream' ) ) {
            echo '<div id="page-title"><div class="wrap"><h1>What\'s On My Mind</h1><a class="page-title-button" href="http://www.briangardner.com/newsletter-signup/">Subscribe Now</a></div></div>';
        }
        • Ray says

          Could you please make this more clear and simple? thanks, all I really want to do is add a tittle and date like yours but don’t understand what to edit. I added it to the archive-stream and caused an error.

          I have a little in paypal I could pay someone for help. Thank you very much.

          Ray

        • says

          I think you’re guiding us for “Minimum” theme but we’re not using it. I’m using “Streamline” theme.
          Can you please tell us how do we use / add page-title.php, for other themes, only for stream page?

          Thanks again. :)

  11. says

    Great idea… i post ideas all the time on my blogs

    One Question:
    Will this work with remote posting via Windows Live Writer?
    It works brilliantly with categories, but I have no idea about a stream page…
    I don’t care about anything fancy, just duplicating your stream page on my Minimum theme based site is fine

    Pre-Revolutionary Jim

  12. says

    reading more on your blog about streams….

    Looks to me like the simplest way to have a stream
    is to create a category for this, and then eliminate that one category
    from the RSS feed?

    Is that correct?
    Everything runs thru feedburner… is that OK too?

    ==>Jim

  13. Ray says

    Brian,

    I love you and I love your site! Thank you! I would like to be able to add a title, like your “What’s On My Mind” … and the date, the “Posted on…” line you have under each stream.

    Could you let us know how to do that? I’m using a page rather than category.

    thanks so much!

    • says

      While you can register the Stream custom post type on your Twenty Eleven theme, the code that’s in the archive-stream.php file won’t work. With that said, you’d still have everything from the Stream post showing on your page.

  14. says

    Hey Brian,

    I’ve added the Stream to my site… So easy to do thanks!.. and managed to edit/style it up a bit with a few hooks thanks to the Studiopress tutorials section.

    Question: is there a way to put content before the archive stream? Almost like an intro to the stream you see below but only on the archive page. It would then disappear when you went into each post.

    Here’s my example: http://www.paulletourneau.ca/stream/

    I also managed to snag the RSS feed from this and set it up to auto tweet when I share a new Stream post. Very cool stuff. Thanks!

  15. says

    Brian, I finally had the chance to sit down and put your good instructions and great idea into place on my Genesis site. What a terrific idea and the perfect solution for my desire to capture things I’m thinking about without adding them to my blog feed. Ever since Revolution days you’ve offered such value to your readers and customers…I’m grateful to use your products and read your blog. Thank you!

  16. says

    Hey Brian,

    Would it be possible to use this as a photo stream?

    Say full width with a single image for each post?

    I want to add a photo a day stream to my site.

    Thanks in advance.

    Be Good

    Louis

  17. says

    This could be gold, indeed.

    From my perspective it would be really cool to have post info display like “2 hours ago” and have a custom number of posts to show not the default setting of 10 or whatever you have in Reading settings.

    Thanks, Brian. Great stuff!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>