0
votes

I'm running Wordpress 4.1. I have two blog pages on my site, and though I don't really know php, I've done some tinkering and figured out how to modify the page templates so each page only displays posts for a specific category. That bit of code looks like this:

<?php query_posts('cat=2'); ?>

That works fine. Page A displays posts from category 1, and Page B displays posts from category 2.

What I'd like to do is disable post title links for one specific category. In other words, Page A would display posts from category 1 (with standard clickable title links), and while Page B would display posts from category 2 (with non-clickable title links).

I'm an HTML/CSS guy, so really out of my depth here, but if there's a way to modify the loop to achieve this, I'd love to learn how. Thanks in advance for any help.

1

1 Answers

0
votes

Yes, you can do this using the category.php theme file. When this page is hit, it loads a specific category requested and the posts that fall into that category.

Your theme and loop may look something like this:

<?php single_cat_title(); ?>
<?php echo category_description(); ?>
if (have_posts()) : while (have_posts()) : the_post();
/// display posts from specific category
endwhile; endif;

Or if you don't want to use that page which is designed for that, you can create your own loop:

query_posts( array ( 'category_name' => 'my-category-slug', 'posts_per_page' => 50 ) );

All together like this:

<?php
/* retrieve unlimited # of posts with an category slug of music */

query_posts(  array ( 'category_name' => 'music', 'posts_per_page' => -1 )  );

// set $more to 0 in order to only get the first part of the post
global $more;
$more = 0;

// the Loop
while (have_posts()) : the_post();
    the_content( 'Read the full post ยป' );
endwhile;
?>