WordPress.org

Ready to get started?Download WordPress

Forums

Page of posts in Thematic/Second To None theme (2 posts)

  1. bac2
    Member
    Posted 4 years ago #

    Hi,

    I'm trying to setup some of my pages on my site to show posts from specific categories. I have found some exsamples of how others are doing this, but my coding skills are very limited, so I have not been succesful in doing this for my own theme. I have managed to link the pages with the categories, but I'm having some difficulties regarding the loop.

    Best Regards
    Bjarne

  2. bac2
    Member
    Posted 4 years ago #

    So far my page.php looks like this:

    <?php //MODIFIED ?>
    
    <?php get_header() ?>
    
    	<div id="container">
    		<div id="content">
    
    <?php get_sidebar('page-top') ?>
    
    <?php
    //itm page12, cat3
    //im page109, cat29
    //it page10, cat4
    //pm page89, cat25
    //om page26, cat5
    //res page6, cat6
    
    $catID = 0;
    if (is_page('12')) {
      $catID=3;
    } elseif (is_page('109')) {
      $catID=29;
    } elseif (is_page('10')) {
      $catID=4;
    } elseif (is_page('89')) {
      $catID=25;
    } elseif (is_page('26')) {
      $catID=5;
    } elseif (is_page('6')) {
      $catID=6;
    }
    
    $showposts = -1; // -1 shows all posts
    $do_not_show_stickies = 1; // 0 to show stickies
    $args=array(
       'category__in' => $catID,
       'showposts' => $showposts,
       'caller_get_posts' => $do_not_show_stickies
       );
    $my_query = new WP_Query($args); 
    
    ?>
    
    <?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() ?>

Topic Closed

This topic has been closed to new replies.

About this Topic