dsimonse
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: WordPress 3.3.1 Category/Tags 404 ProblemHi,
I have the 404 issue in WP3.4 when paginating categories (and I had it a while since WP3.1). I browsed through the web and tried several solutions but none worked.
@rafaelxy: What do you mean with:
“Basicly, you CANT have a PAGE and a CUSTOM POST TYPE with the same name. If you do, the permalink rewrite rules will get confused and trigger a 404.A very simple solution I’m using is: The page that lists the custom post types is called in plural (eg. products) and the actual post type name is in singular (eg. product). So they dont conflict and it’s all fine.”
I am quite new to WP so what is the difference btw PAGE and CUSTOM POST TYPE? I.e whe should I check if I have your described problem?
And .. I tried your code for the function.php with no result.
Do I have to change anything in “category.php” as well?
The code:<?php get_header(); ?> <?php wp_reset_query(); $cat = get_cat_id(single_cat_title("",false)); if ($cat == 5 or $cat == 6 or $cat == 7){ $cat = '5,6,7';} $pages = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=3&paged=$pages&cat=".$cat); if(have_posts()) : while(have_posts()) : the_post(); ?> <div class="post grid_20" id="<?php the_ID(); ?>"> <?php include 'incl/info-bar.php' ?> <div class="left"><?php the_post_thumbnail( 'blog-post-thumbnail' ); ?></div> <div class="grid_7"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php $args = array( 'post_type' => 'attachment', 'numberposts' => null, 'post_status' => null, 'post_parent' => $post->ID, 'showposts' => 3, 'offset' => 1, ); $attachments = get_posts($args); $len = 250; //Number of words to display in excerpt $newExcerpt = substr($post->post_content, 0, $len); if (count($newExcerpt) > 30 or count($attachments) < 3){ if(strlen($newExcerpt) < strlen($post->post_content)) { $newExcerpt = $newExcerpt.'... <a href="'.get_permalink().'">Läs mer</a>'; } echo '<div class="entry"><p>'.$newExcerpt.'</p></div>'; //finally display excerpt } else { if ($attachments) { echo '<div class="images left">'; foreach ($attachments as $attachment) { echo wp_get_attachment_link($attachment->ID, 'thumbnail'); } echo '</div>'; }} ?> </div> <div class="comments grid_6 omega"> <?php $args = array( 'status' => 'approve', 'number' => '2', 'post_id' => $post->ID, // use post_id, not post_ID ); $comments = get_comments($args); if($comments) { ?> <h4><?php comments_popup_link('', '1 Kommentar', '% Kommentarer'); ?></h4> <ul> <?php foreach($comments as $comment): $length = 40; // adjust to needed length $thiscomment = $comment->comment_content; if ( strlen($thiscomment) > $length ) { $thiscomment = substr($thiscomment,0,$length); $thiscomment = $thiscomment .' ...'; } ?> <li id="comment-<?php comment_ID() ?>"> <div class="left"><?php echo get_avatar( get_comment_author_email(), '40' ); ?></div> <p><a href="<?php the_permalink(); ?>/#comment-<?php comment_ID() ?>"><?php comment_author(); ?></a>: <?php echo ($thiscomment);?> <br /> <span><?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' sedan'; ?></span></p> </li> <?php endforeach; ?> </ul> <?php } else { ?> <h4><a href="<?php the_permalink(); ?>">Inga kommentarer (Kommentera)</a></h4> <?php } ?> </div> </div> <!-- .post --> <?php endwhile; endif;?> <div class="undernav grid_17 push_3"> <?php if (function_exists("pagination")) { pagination($additional_loop->max_num_pages); } ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>The URL: http://rojteatern.nu