Herself's Webtools

Scripts, HowTos, Templates, Plugins, Widgets, Tips

Security plugins updated

without comments

This week I updated all three WordPress security plugins – install and uninstall functions were added, the user interface and code was cleaned up. I hope to make them smarter over the coming few months.

Tripwire
Download WordPress Tripwire Plugin

Prevent bot registrations
Download WordPress Bot Blocker Plugin

Security plugin
Download WordPress Security Plugin

Written by Linda MacPhee-Cobb

August 12th, 2011 at 7:45 am

Posted in security,useful software,wordpress

How to create a list of posts by category in WordPress

with 2 comments

I have to say creating a link lists of posts by category in WordPress is downright painful. To create the archive list ( see link near search box on sidebar ) you need a list of your categories, the category number. You will use these to create an archives.php page.

1) A list of your categories can be found by going to the Dashboard, then drop down the Posts menu and select categories.  These are the headings you put between the <br><h3>Category Name</h3> in the php below.

2) Category numbers had to be dug out of my database.  I used MySQL Admin, went to my WordPress database.  Select your database, find the wp_terms table and click on the leftmost icon under ‘Action’ to list your tags and categories. The link_id is the category number.

3) PHP code copy and paste this to a file named Archives.php.  Change the category names and numbers to match those on your website.  Also add or delete as many categories as you need. Your template is likely different than mine you may need to adjust the sidebar, footer etc to match your template’s style

4) showposts=200 is the maximum number of posts it will show in that category, adjust if you need to.

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

<?php get_header(); ?>

<div id=”content”>

<h2>Archives</h2>

<div>

<p>Complete archive of the blog’s posts sorted by category</p>

<br><h3>Fun things to do in Houston</h3>
<?php query_posts(‘cat=5&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>OMG We’re in Texas</h3>
<?php query_posts(‘cat=7&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>The Move</h3>
<?php query_posts(‘cat=15&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>This ‘n That</h3>
<?php query_posts(‘cat=14&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>Tokyo Trip</h3>
<?php query_posts(‘cat=172&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>Geekiness</h3>
<?php query_posts(‘cat=83&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

<br><h3>Photos</h3>
<?php query_posts(‘cat=10&showposts=200′); ?>
<?php while (have_posts()): the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>

</div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

5) Upload your archives.php file to your theme directory on your webserver.

6) Finally create a new page – drop down the attributes menu on the right and select archives as your template

Or if you’d rather there’s a new plugin out to do display all posts in all categories for you James Wilkes Web Design

Written by Linda MacPhee-Cobb

April 2nd, 2010 at 11:51 am

Posted in archives,hack your template,how to,php,wordpress,wordpress template