WP CMS-help me put the pieces together.
-
I’m trying to make WordPress into my idea of what a writer’s CMS should be. I think my wants are modest but so are my coding abilities. I believe I have all the pieces I need to do what I want. I just don’t know how to put them together.
What I want is a Page that will list the titles in a given category automatically. Right now I use the following but have to make a new Page template for each new story/category I start.
<?php
$photog_posts = new WP_Query(‘category_name=el&order=asc&showposts=-1’); while($photog_posts->have_posts()) : $photog_posts->the_post();
?><li><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”Permalink to <?php the_title(); ?>”><?php the_title(); ?</a>
</li>
<?php endwhile; ?></ul>
I have a category called “Eight Lines” I made its slug “el”, when I set up a Page for it I made its slug “el” also. This bite of code <?php echo $post->post_name; > gives me the Page slug. However putting the code in like so, (‘category_name=<?php echo $post->post_name; ?>&order=asc&showposts=-1’);, is not working. I have tried different things but I don’t know what to do.
So how do I get the out put of <?php echo $post->post_name; ?> to where I want it on the other side of category_name=.
I use a different bit of code for the sidebar and tried to fit it in there but again no luck.
<?php
$cat = get_the_category();
$cat = $cat[0];
$posts = get_posts(“category=” . $cat->cat_ID . “&order=asc&numberposts=10000”);
if( $posts ) :
?><?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<li><id=”post-<?php the_ID(); ?>”>
<a href=”<?php the_permalink() ?>” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></a>
</li>
<?php endforeach; ?>
<?php endif; ?>I will appreciate any help anyone can give me. Also many thanks to the people that posted the code I am using now.
- The topic ‘WP CMS-help me put the pieces together.’ is closed to new replies.