ThemeShaper Forums » Thematic

[closed]

Running blog pages and website pages

(11 posts)
  • Started 9 years ago by tjdj
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Hi,
    My site is http://www.tjdjmusic.com/ and I'm wondering how I could add a blog onto my site. For example, I want to keep my site pages up there as is, but also have a dedicated blog page where I can upload posts, have RSS feed options, etc.

    Any help would be greatly appreciated.

    Thanks,
    Tim

    Posted 9 years ago #
  2. You'll need to create a new page template. Copy index.php from the Thematic folder into your child theme directory. Then change the name of that file to "template-blog.php".

    Add these lines at the top of the file:

    <?php
    /*
    Template Name: Blog
    */
    ?>

    Then add this line right after <div id="content">

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged"); ?>

    Upload that new file to your child theme directory.

    Now from WordPress, create a new page called "Blog" or "Posts", or whatever you want your menu item to appear as. From "templates" in the bottom right of the edit page, choose "Blog".

    When you save this page, you should now have your posts show up there.

    Here's the complete code for the page template in case you just want to copy paste:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    
    <?php
    
        // calling the header.php
        get_header();
    
        // action hook for placing content above #container
        thematic_abovecontainer();
    
    ?>
    
    	<div id="container">
    
    		<?php thematic_abovecontent(); ?>
    
    		<div id="content">
    
            <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged"); ?>
    
    			<?php 
    
                // create the navigation above the content
                thematic_navigation_above();
    
                // calling the widget area 'index-top'
                get_sidebar('index-top');
    
                // action hook for placing content above the index loop
                thematic_above_indexloop();
    
                // action hook creating the index loop
                thematic_indexloop();
    
                // action hook for placing content below the index loop
                thematic_below_indexloop();
    
                // calling the widget area 'index-bottom'
                get_sidebar('index-bottom');
    
                // create the navigation below the content
                thematic_navigation_below();
    
                ?>
    
    		</div><!-- #content -->
    
    		<?php thematic_belowcontent(); ?> 
    
    	</div><!-- #container -->
    
    <?php 
    
        // action hook for placing content below #container
        thematic_belowcontainer();
    
        // calling the standard sidebar
        thematic_sidebar();
    
        // calling footer.php
        get_footer();
    
    ?>
    Posted 9 years ago #
  3. Thank you. A few questions...and sorry I'm a newbie with all this stuff.

    Re: Copy index.php from the Thematic folder into your child theme directory. Then change the name of that file to "template-blog.php".

    Are you saying to copy all the text in the index.php file to the child theme directory? Where is my child theme director? Finally, how do I change the template-blog.php name?

    Is there a widget that would enable blog posting? I'm wondering if that would be better for me since I'm not very familiar with programming like this. Thx!

    Posted 9 years ago #
  4. You can already post blogs with WordPress. Just create a post and you are ready to go.

    If you want to display the posts on your site, you will have to change your reading options so that the posts display on the home page (http://codex.wordpress.org/Settings_Reading_SubPanel) or build a page template to display them.

    To upload the new template, which I mentioned above, you'll need to have ftp access to your site. You would be copying the file "index.php"- the entire file, so there are now two copies of the file- and then you rename the filename from index.php to template-blog.php.

    Posted 9 years ago #
  5. Hi,
    I was looking for help for a similar problem and this helped a bit already. Thanks for that!

    My additional problem is that I want to run a second blog on one page of my primary blog. Kind of like tjdj in this topic, except that I want to have two pages; "news" and "blog", be able to write posts on both and have them be published on only one of the pages and have all this be powered on one Wordpress admin panel.

    I got this far with your advice and advice from this thread: http://wordpress.org/support/topic/268730
    That thread introduced me to the idea of separating the destination of the two posts with categories. I got pretty far as you can check from my site: www.siroproduction.com.

    This is how my coding/guessing progressed:

    The blog-page now only shows the post with category "blog" checked. On the other hand the news page still shows both categories. The thread mentioned in the previous paragraph didn't really help me because the Thematic theme didn't seem to have a category.php-file. I found category-extensions.php in the thematic library. That had similar parts in the code (loop command), but tweaking that caused by site to crash completely.

    How do I configure the news-page to only show categories marked news? Additionally why doesn't the blog-page show the Vimeo-video embedded on the page?

    Thanks a million!

    Posted 9 years ago #
  6. @tjdj - Changing your reading settings is the simplest way to create a dedicated blog page... I presume you are using a static page as your home/front page or your home page would be displaying your blog posts? Anyway, following Devin's link: You create a new page, call it blog, leave it blank and publish it. Then go to Settings>Reading and select blog under the Posts page dropdown. Now the page Blog will display your blog posts w/o a template.

    @phobos - I would take Devin's code and suggestions.... and use it to create one template for the blog index and a 2nd template for News. The principal difference being editing your query to only call posts from the News category on one and the blog category on the other.

    above the line of code is:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged"); ?>

    based on the link to WP support I'd try replacing that with:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    'category_name' => 'Name of Your Category',
    'paged' => $paged
    );
    query_posts($args);
    ?>

    I've not tried this so ymmv. good luck.

    Posted 9 years ago #
  7. Hi,
    sorry for being so green on this topic, but could you clarify in which files I should insert the bits of code you mentioned.

    Thanks.

    Posted 9 years ago #
  8. Re-read Devin's post above. You are going to create 2 files with the code he has provided above. Call one blog-template.php and put

    <?php /* Template Name: Blog */?>

    at the top. and

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    'category_name' => 'blog',
    'paged' => $paged
    );
    query_posts($args);
    ?>

    right after the #content div... replacing

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged"); ?>

    Call the other news-template.php and put

    <?php /* Template Name: News */ ?>

    at the top and:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    'category_name' => 'news',
    'paged' => $paged
    );
    query_posts($args);
    ?>

    after the #content div again replacing Devin's original query.

    Posted 9 years ago #
  9. @Devin- I tried this for myself finally. I have a blank page named Blog and applied my template to it. I didn't get a template.php body class for that page. Is that normal?

    Posted 9 years ago #
  10. Hmm. No, I just tested this again locally, and I got the following body classes "wordpress blogid-1 y2010 m05 d10 h22 singular slug-blog page pageid-18 page-author-devin page-comments-open page-pings-open page-template page-template-template-blog-php mac firefox ff3".

    Here's what my template code looked like:

    <?php
    /*
    Template Name: Blog
    */
    ?>
    
    <?php
    
        // calling the header.php
        get_header();
    
        // action hook for placing content above #container
        thematic_abovecontainer();
    
    ?>
    
    	<div id="container">
    
    		<?php thematic_abovecontent(); ?>
    
    		<div id="content">
    
            <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged"); ?>
    
    			<?php 
    
                // create the navigation above the content
                thematic_navigation_above();
    
                // calling the widget area 'index-top'
                get_sidebar('index-top');
    
                // action hook for placing content above the index loop
                thematic_above_indexloop();
    
                // action hook creating the index loop
                thematic_indexloop();
    
                // action hook for placing content below the index loop
                thematic_below_indexloop();
    
                // calling the widget area 'index-bottom'
                get_sidebar('index-bottom');
    
                // create the navigation below the content
                thematic_navigation_below();
    
                ?>
    
    		</div><!-- #content -->
    
    		<?php thematic_belowcontent(); ?> 
    
    	</div><!-- #container -->
    
    <?php 
    
        // action hook for placing content below #container
        thematic_belowcontainer();
    
        // calling the standard sidebar
        thematic_sidebar();
    
        // calling footer.php
        get_footer();
    
    ?>

    Could someone weight in as to whether wp_reset_query(); is needed after the loop? Not sure if that screws up paging or if it is actually needed.

    Posted 9 years ago #
  11. I thought that the body classes were supposed to be there. I am not sure what I did, but I got them back somehow.

    As far as wp_reset_query() I don't have it anywhere ( I dont think) and it doesn't seem to mess up my paging. Posts 1-10 appear on the first page and page 2 begins w/ post 11 like it should.

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.