• Go to the Wiki and find the Show Category Posts plug in by Kitten. Install it on your installation of WP and activate it. Create a Category called miniblog and not the number of the category.
    There are two steps to this process.
    1) removing the miniblog category from your regular blog posts.
    2) setting up the miniblog itself
    step 1) I used a hack in my-hacks.php to actually remove the miniblog category from the regular blog.
    insert this into your my-hacks.php file changing the 25 in the second line to the category # that pertains to your miniblog category.
    function the_category_IDs() {
    $IDs = array();
    $categories=get_the_category();
    foreach ($categories as $category)
    {
    $IDs[] = $category->category_id;
    };
    return $IDs;
    }
    function isthree($post) {
    return (in_array(25,the_category_IDs()));
    }
    function remove_posts($function) {
    global $posts, $post;
    $newposts = array ();
    if (stristr($function,’!’))
    {
    $function = explode(‘!’,$function);
    $function = $function[1];
    foreach ($posts as $post) {
    if ($function($post))
    {
    $newposts[] = $post;
    }
    }
    } else {
    foreach ($posts as $post) {
    if (!$function($post))
    {
    $newposts[] = $post;
    }
    }
    }
    return $newposts;
    }?>
    Insert this line just after the start of the loop in index.php
    <?php $posts = remove_posts(‘isthree’) ?>
    THAT IS ALL FOR STEP 1. YOUR MINIBLOG CATEGORY SHOULD NOT SHOW UP IN YOUR REGULAR POSTS.
    Step 2) insert the following code wherever you store your sidebar/menu (wherever you are putting the miniblog) code.
    If you want more or less post than I have in my miniblog edit the post information accordingly. The 25 in the third line should be changed to whatever # corresponds to the number of your miniblog category.
    <div id=”miniblog”>
    <div id=”menu2″>
    <?php echo show_category_posts(’25’); ?><br>
    <?php if ($scp_posts) : foreach ($scp_posts as $post) : start_wp(); ?><?php the_date(”,'<h2>’,'</h2>’); ?>
    <div class=”storycontent”>
    <?php the_content(); ?>
    </div>
    <div class=”feedback”>
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’)); ?>
    </div><?php endforeach; else: ?>

    <?php _e(‘Sorry, no posts matched your criteria.’); ?>
    <?php endif; ?></div></div>
    This should do it for you! Have fun!
    EDIT: I screwed up a couple of lines of code above, they have since been corrected, please use this or copy and paste the code from the link many posts below.

Viewing 9 replies - 16 through 24 (of 24 total)
  • the_category_IDs() function needs to be defined. goodsnake failed to include the_category_IDs() function definition.

    Harumph.

    And umm how do I define them? I really don’t know anything.

    Thread Starter goodsnake

    (@goodsnake)

    I will be happy to look at the code you are using if you will tell me where you have it… it is hard to troubleshoot without the code.
    I have pasted my menu.php file here https://paste.uni.cc/1228
    and my index.php file here if you want to look at the code. https://paste.uni.cc/1229
    the my-hacks.php can be copied here https://paste.uni.cc/1230 , please use this since I f#$%ed up and forgot the first few lines of code above.

    I did exactly that. I made sure I changed the numer 25 to the number of my miniblog in both the my-hacks.php and the code for the index page. I made sure to double and triple check what I did. But I still get the errors. And I don’t know what it means to define the the_category_IDs() function. Or how to do that if it isn’t already done.

    This is what my-hacks.php looks like: https://paste.uni.cc/1231
    And this is the miniblog code on my index page in the sidebar: https://paste.uni.cc/1232

    Ok, thanks for helping goodsnake, but I couldn’t get the my-hacks.php thing to work at all. But Kitten released a new version of the plugin allowing mini blogs. So I’m going to use that. Since my-hacks.php and me were just not meant to be. Thanks again.

    show_category_posts function is not defined… am i missing something?

    Im trying to use the above code to create a miniblog on my site also, and when I was done, in the main area….my mini blog showed up as a post and where the mini blog was supposed to be in showed up saying there are no posts that match your criteria…..
    Suggestions?
    (Yes both places refelct the ID of my “miniblog”.)

Viewing 9 replies - 16 through 24 (of 24 total)
  • The topic ‘How to do a miniblog…’ is closed to new replies.