ThemeShaper Forums » Thematic

[closed]

How do I add multiple blogs to my thematic site?

(18 posts)
  • Started 9 years ago by cmgray
  • Latest reply from albertelo
  • This topic is not resolved
  1. cmgray
    Member

    Hi,

    I'm new to thematic/Wordpress. I want my sit to have several pages with a blog format, including the homepage and one other page. How would I go about doing this?

    Thanks!

    Posted 9 years ago #
  2. Hi,

    are you talking 'bout different blogs in terms of several 'physical' blogs?

    .. or is just a thing of different categories?

    Chris

    Posted 9 years ago #
  3. cmgray
    Member

    Hi,

    Sorry for the belated reply. I did not see that you had responded. What I mean is this: when you create a blog with wordpress, the homepage is automatically in a traditional blog format (i.e. displays posts). You can then add static Pages. I want multiple blogs in the sense that I want multiple pages that display posts like the default homepage. Does that make sense? I'm not sure if I'm articulating this well.

    Is this something that can be done with categories?

    Thanks!

    Chloe

    Posted 9 years ago #
  4. Hi Chloe,

    this could be done as long as you keep in mind that you may assign only one category to a post.

    I'm doing this on my blog with one category.

    First of all you need the Page Links To Plugin.

    Create a page and ĂȘnter the URL into the "Point to this URL":

    http://www.yourdomain.com/category/the_category_name/

    In case you want to create a special category template for this:

    Copy the index.php from the thematic directory into your child theme directory and rename this file to:

    category-252.php

    On my blog the categroy has the ID 252.

    Now you need to add some code to your child theme's functions.php:

    // This will keep your category out of the 'home' page
    function exclude_category($query) {
    	if ( $query->is_feed || $query->is_home ) {
    		$query->set('cat', '-252');
    	}
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');
    
    // If you display a single post called from the 'Home' page, you don't want to run into a post from your special category while clicking on next / previous post. If you display a singled post called from your special category page, you don't want to run into any post that's not from this category, while clicking on next / previous post.
    function childtheme_previous_post_link_args($args) {
    		global $wp_query;
    		$category = get_the_category();
    		echo $category->cat_ID;
    		if (in_category('252')) {
    				$args = array ('format'              => '%link',
    											 'link'                => '<span class="meta-nav">&laquo;</span> %title',
    											 'in_same_cat'         => TRUE,
    											 'excluded_categories' => '');
    			}
    		else {
    				$args = array ('format'              => '%link',
    											 'link'                => '<span class="meta-nav">&laquo;</span> %title',
    											 'in_same_cat'         => FALSE,
    											 'excluded_categories' => '252');
    		}
    		return $args;
    }
    add_filter('thematic_previous_post_link_args', 'childtheme_previous_post_link_args');
    
    function childtheme_next_post_link_args($args) {
    		global $wp_query;
    		$category = get_the_category();
    		echo $category->cat_ID;
    		if (in_category('252')) {
    				$args = array ('format'              => '%link',
    											 'link'                => '%title <span class="meta-nav">&raquo;</span>',
    											 'in_same_cat'         => TRUE,
    											 'excluded_categories' => '');
    			}
    		else {
    				$args = array ('format'              => '%link',
    											 'link'                => '%title <span class="meta-nav">&raquo;</span>',
    											 'in_same_cat'         => FALSE,
    											 'excluded_categories' => '252');
    		}
    		return $args;
    }
    add_filter('thematic_next_post_link_args', 'childtheme_next_post_link_args');

    This code just needs to be extended with any additional category.

    Chris

    Posted 9 years ago #
  5. cmgray
    Member

    Thanks Chris! That is really helpful. I will give this a try shortly.

    I have another question regarding Child Themes. I just created a child theme and activated it via the dashboard. The style.css of my child theme indicates that it is pulling from the individual "thematic" style sheets. Should I move those over to my child theme folder or should i still edit them within the "thematic" folder? After activating the child theme, are there additional steps I need to take before I can go to town on the CSS? Are there instructions online on creating child themes that you can direct me to?

    Posted 9 years ago #
  6. Try this tutorial from Matteo:

    http://www.matteostagi.it/eng/fast-develop-wordpress-theme-tutorial-1

    Chris

    Posted 9 years ago #
  7. fedude
    Member

    I have a slightly different situation - maybe the same solution will apply.

    I have a site that has 4 categories for the posts. Each post has only 1 category. I want to display all the posts of each category on a different page.

    So I can use your suggestion above to use Page Links To Plugin to point the menu element to:

    http://www.yourdomain.com/category/the_category_name/

    for each category. In which case I can delete the pages I created to act as containers for the categories. I'll have to clean up the layout which probably means modifying category.php in thematic.

    OR

    I can add a function in every page that queries the category and matches it up to the pages. Something like:

    if page = A then fiter only category A posts else
    if page = B then fiter only category B posts else
    if page = C then fiter only category C posts else
    if page = D then fiter only category D posts else
    Show no posts;

    The 2nd way seems cleaner but looks like a lot of work and I'm not sure if it's even possible. Is there even a hook I can use for this? I think I'd have to put "the loop" in each page....

    What do you think?

    Posted 9 years ago #
  8. fedude
    Member

    I actually implements a combination of both of these solutions and it worked for me. Here's what I did and how I did it:

    http://forums.themeshaper.com/topic/multiple-blogs-to-my-site

    Posted 9 years ago #
  9. I wanted to do the same thing for a website I designed and I ended up writing a plugin that would do it for me. It involves a lot less work and keeps the category.php as normal.

    You can download it at http://wordpress.org/extend/plugins/category-page-extender/ and I have pretty thorough instruction on using it here: http://categorypageextender.wordpress.com/

    Good luck

    Posted 9 years ago #
  10. I have some trouble filtering this snippet into my child theme to get grpsmglr00's plugin running.

    How does this code can get into the page.php right below the loop statement?

    <?php if( function_exists(page2cat_pages)){
         page2cat_pages($post->ID);
    } ?>

    source: http://categorypageextender.wordpress.com/

    Posted 9 years ago #
  11. open the page.php file (or my recommendation is to create a new page template, but both will work) and find where the loop ends. It should be something like this:

    <?php endwhile; endif; ?>

    Then paste this:

    <?php if( function_exists(page2cat_pages)){
    page2cat_pages($post->ID);
    } ?>

    right below it. That should be all there is to it.

    Posted 9 years ago #
  12. The page.php does not have these lines you are talking about. How does this code get to the right place?
    The full code of thematic's page.php looks like this (no loop written in here!) Thanks!

    <?php get_header() ?>
    
    	<div id="container">
    		<div id="content">
    
    <?php get_sidebar('page-top') ?>
    
    <?php the_post() ?>
    			<div id="post-<?php the_ID(); ?>" class="<?php thematic_post_class() ?>">
        			<?php thematic_postheader(); ?>
    				<div class="entry-content">
    <?php the_content() ?>
    
    <?php wp_link_pages("\t\t\t\t\t<div class='page-link'>".__('Pages: ', 'thematic'), "</div>\n", 'number'); ?>
    
    <?php edit_post_link(__('Edit', 'thematic'),'<span class="edit-link">','</span>') ?>
    
    				</div>
    			</div><!-- .post -->
    
    <?php if ( get_post_custom_values('comments') ) thematic_comments_template() // Add a key+value of "comments" to enable comments on this page ?>
    
    <?php get_sidebar('page-bottom') ?>
    
    		</div><!-- #content -->
    	</div><!-- #container -->
    
    <?php thematic_sidebar() ?>
    <?php get_footer() ?>
    Posted 9 years ago #
  13. That's an odd template.... try putting

    <?php if( function_exists(page2cat_pages)){
    page2cat_pages($post->ID);
    } ?>

    right before or after:

    </div><!-- .post -->

    not sure which would work better. good luck

    Posted 9 years ago #
  14. Ok thank you very much, it works when I just put it in this position. The only problem is that some markup gets lost in the posts (uncomfortable to style).
    I finally came up with the solution to just use
    <?php query_posts("cat=4&showposts=2"); ?>
    at position above_thematic_indexloop
    When I would like to display those posts and the page content I just echo a second thematic_index_loop right below.

    Posted 9 years ago #
  15. Today I came up with a non-plugin solution for this and I like it very much:

    http://forums.themeshaper.com/topic/how-to-display-posts-from-categories-on-pages-using-a-second-loop#post-9021

    Posted 9 years ago #
  16. albertelo
    Member

    Hello,

    I used the solution posted by Chris and it works fine except for one thing. The posts that belong to the category that are placed on a different page are shown as excerpts. How can the posts be shown fully collapsed?

    Thanks so much for all the help and support this forum has to offer. The input is excellent and very useful.

    Posted 9 years ago #
  17. Hi albertelo, just look at the first post in this thread

    http://forums.themeshaper.com/topic/how-to-display-posts-from-categories-on-pages-using-a-second-loop#post-9021

    the second code snipped should make your day...

    Posted 9 years ago #
  18. albertelo
    Member

    thanks aaron! works perfectly!

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.