trouble with getting pretty permalinks – please advise
-
hello,
i’m trying to get pretty permalinks with a custom structure as follows:
/%category%/%postname%/it works, however, the navigation on my website is based on categories, and my index.php includes some code which filters out posts by category and displays them as icons:
<div id="fcontent"> <?php $thefront = 'frontpage'; if($_GET[cat]){ $thefront = $_GET[cat]; } $cat_id = $thefront; $categories = get_categories(); foreach( $categories as $category ) { if( $category->term_id == $cat_id ) { $cat_name = $category->name; break; } } query_posts("category_name=$cat_name&showposts=35"); if (have_posts()) : while (have_posts()) : the_post(); $new_excerpt = wpautop(clean_pre($post->post_excerpt)); $newp = '<p><a href="' . $post->guid . '" title="' . $post->post_title . '" rel="bookmark">'; $new_excerpt = str_replace('<p>',$newp, $new_excerpt); $new_excerpt = str_replace('</p>','</a></p>', $new_excerpt); $sfront[] = array('link' => $post->guid, 'title' => $post->post_title, 'id' => $post->ID,'excerpt' => $new_excerpt); endwhile; else: ?> <p><?php _e('Sorry, no results found.'); ?></p> <?php endif; shuffle($sfront); array_splice($sfront, 20); $p=0; foreach($sfront as $sp) { $sid = $sp['id']; ?> <? if ($p == 3) { echo '<div style="clear:both;padding-top:10px;"></div>'; $p=1;} else { $p++; }; ?> <div class="fpost" id="post-<?=$sid;?>"> <div class="storytitlefront"><a href="<?=$sp['link'];?>" title="<?=$sp['title'];?>" rel="bookmark"><?=$sp['title'];?></a></div> <div class="storycontent"> <? echo $sp['excerpt']; ?> </div> </div> <? }; ?> <?php //posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?> <?php get_footer(); ?>
my index.php looks like this:
<?php get_header(); ?> <div id="content"> <?php if($_GET[cat]){ include('test.php'); }else{ ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?> / <?php the_time('Y') ?>"><?php the_title(); ?></a></div> <div class="storycontent"> <?php the_content(__('(more...)')); ?> <?php edit_post_link('Edit'); ?> </div> </div> <?php endwhile; else: ?> <p><?php _e('Sorry, no results found.'); ?></p> <?php endif; ?> <?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?> <?php get_footer(); ?> <? }?>
so, when custom permalinks are set, the feature of filtering posts by categories and displaying them as icons is gone, and instead, whenever i choose a category, i get a single page which includes all the posts in that cateogry displayed with their full content rather as icons.
how should i fix that?
will appreciate some help!
regards,
spk.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘trouble with getting pretty permalinks – please advise’ is closed to new replies.