• Resolved CapeCodBranding

    (@capecodbranding)


    I currently use the permalink structure ‘Day & Name” and I love it b/c it is very easy to ‘see’ what page you are on in my blog. I’d like to keep using that structure for my links. The problem is that Categories don’t work on my site. No matter which Category widget I use, it just yields a blank page (with header but no content). However, Categories do work if I use the Default Permalink structure.
    My category link structure is currently redirecting to this;

    https://capecodbranding.com/blog/category/how-to/

    How can I alter this so categories work? I noticed in “Control Panel > Settings > Permalinks” there is a place to override just the categories (or tags) link structure and I’ve been playing around but can’t find a solution that works.

    Any help would be appreciated!
    Thanks,
    amy

Viewing 15 replies - 16 through 30 (of 36 total)
  • Yes @capecodbranding. I suggest using the code that I pasted above. That is the standard .htaccess code for WordPress. To fix the error message, I would suggest loading a fresh copy of the category.php file in your theme’s folder.

    Thread Starter CapeCodBranding

    (@capecodbranding)

    @iridiax I renamed the .htaccess files (both root and blog). However, I think I’ll need to fix my ‘other’ problem, the error on the cat pages, first before I’ll know what I’m up against. Thanks for the assistance, hopefully I’ll get it figured out tonight. ??

    @parkstreet The theme I’m using didn’t have a category.php file to begin with. I’ve checked my backup copy, AND downloaded a fresh copy from the designer…. no category.php. Since it didn’t have one initially, do I need one now (I know that may be a silly question) and if I do need one, is there a ‘standard’ version I can add to my theme. I’m not sure if that is the kind of thing I can just find in a universal format and add?

    Thanks again!

    If there was not one there to begin with then, I wouldn’t add it, but then I don’t understand your error message. Why is it looking for category.php? Also, if you are using the theme I think you are using, make sure the following files are there: r_sidebar.php, l_sidebar.php, & sidebar.php.

    Thread Starter CapeCodBranding

    (@capecodbranding)

    OK! Here is what I did;

    1. reinstalled my theme (bluebird) and replaced the new stylesheet with my old one. Added all my images back in and added my favicon back to the header.php.
    2. Changed the 301 redirect code on my .htaccess file to the code Parkstreet gave me (from earlier in this thread).
    3. Enabled my .htaccess files by renaming them back to “.htaccess” (yesterday I had renamed them to disable).
    4. Activated WP-Cumulus and put the widget back in my sidebar.

    Now my categories work, and no error message! Yay!

    Just one more question, @parkstreet, you found a link structure yesterday that pulled up a category page that had all my articles in list form. As it stands now, when you click a category it pulls up the full articles. Is it an easy fix to get the list of posts to show instead?

    Thanks so much to everyone for all of their help!!!

    amy

    Hmmm, not sure. Your new url structure to the list is https://capecodbranding.com/blog/posts/sorted-by-category/apple/ Without knowing where /posts/ and /sorted-by-category/ is coming from and how it is being generated, its a little difficult to figure out a fix. Also, you have this structure: https://capecodbranding.com/blog/posts/sorted-by-category/ and this structure: https://capecodbranding.com/blog/posts/ Do you know if Articles is a page? Also, it is setup like an archive page. Not sure if that helps or not.

    Thread Starter CapeCodBranding

    (@capecodbranding)

    Ok, I know where those are coming from; Articles is a page we created, but it’s actually called ‘posts’ in the permalink (it was renamed as Articles recently to be more descriptive and the permalink stayed the original name). Also, “Sorted by Category” is a child page of Posts (Articles). We update those pages ourselves because we couldn’t find a category widget that broke down the categories into sections by date or topic. The problem is that we have a hard time keeping it up-to-date and error-free and it would be great to find an option that is automated.

    I went back and looked at my permalinks and found I had entered “post/category” for the Category Base. I’m not sure now why I did that, I’ve made so many changes the last couple of days my head is spinning… Anyway, I removed it and now my categories direct to;

    https://capecodbranding.com/blog/category/apple/

    Still in full article format, so it didn’t change anything over how it was before (other than it now goes to where it should w/o any of my manually added pages in the link). So now I just need to find a way to have my articles show title only when they come up in the category list.

    Thanks again for all the help!

    No problem, I am glad that you finally got it sorted out. I will be thinking about the list page and if I come up with anything, I will let you know.

    Ok, so I was looking at the files included in the theme you are using. The same code/structure is used for both the index.php and single.php files. I believe that you will need to change some code in the single.php file from this:

    <?php the_content('Continue reading  &raquo;'); ?>

    To this:

    <?php //the_content('Continue reading  &raquo;'); ?>

    I am not sure what is going to happen when you click on the title link, but this will let you see if this is the file you need to be looking at in order to create a category list. If it doesn’t work, then revert the changes you made.

    Thread Starter CapeCodBranding

    (@capecodbranding)

    Hi Parkstreet,

    Thanks for all the time you are devoting to my problem. It means a lot to me. ??

    I’ve made the changes you suggested. I haven’t changed it back yet, even though it doesn’t appear to do what we’d hoped. The articles still show in full text, then when you click on the title it goes to just the title.

    Does this teach us what the next step should be?

    Thanks!
    amy

    Hmmm, I figured as much. Ok, now revert the changes you made to the single.php file and create a category.php file with the following information:

    <?php get_header(); ?>
    
        <div id="content">
    
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    <!-- item -->
    				<div class="item entry" id="post-<?php the_ID(); ?>">
    				          <div class="itemhead">
    				            <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    				            <div class="date"><?php the_time('F jS, Y') ?> </div>
    
    								<?php //the_content('Continue reading  &raquo;'); ?>
    
    				          <small class="metadata">
    							 Filed under <span class="category"><?php the_category(', ') ?> </span> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('Comment (0)', ' Comment (1)', 'Comments (%)'); ?></small>
    							 <div style="clear:both;"></div>
    <div style="clear:both;"></div>
    				 </div></div>
    <!-- end item -->
    
    <?php comments_template(); // Get wp-comments.php template ?>
    
    		<?php endwhile; ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
    			<p> </p>
    		</div>
    
    	<?php else : ?>
    
    		<h2 class="center">Not Found</h2>
    		<p class="center">Sorry, but you are looking for something that isn't here.</p>
    
    	<?php endif; ?>
    <!-- end content -->
    
    	</div>
    	<div id="secondary">
    
    <?php include(TEMPLATEPATH."/l_sidebar.php");?>
    
    <?php include(TEMPLATEPATH."/r_sidebar.php");?>
    
    	</div>
    <?php get_footer(); ?>
    Thread Starter CapeCodBranding

    (@capecodbranding)

    Perfect! Now a category redirects here;

    https://capecodbranding.com/blog/category/apple/

    Any way to make the font smaller? I couldn’t find any font size html in the code.

    Thanks, thanks, thanks!

    Are you looking to make the font smaller throughout your website or only on this page?

    Thread Starter CapeCodBranding

    (@capecodbranding)

    Only on this page. I noticed that the titles are much bigger than on other pages. The rest of the text is fine, I’d just like to make the titles smaller so they don’t run off the edge into my sidebar.

    Ok, in category.php, change this:

    <h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>

    to this

    <h1 class="cat-title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>

    Then in your stylesheet, add this:

    h1.cat-title {
    font-size:.9em;
    }

    You may need to play around with it, if .9em is too small then try 1em, 1.1em, 1.2em, and so on.

    Thread Starter CapeCodBranding

    (@capecodbranding)

    Wow! That worked like a charm!

    https://capecodbranding.com/blog/category/apple/

    I have one more question (promise only one!), is there a way to set it so more than 3 articles show per page? I was thinking of maybe a list of 50.

    Thanks again,
    amy

Viewing 15 replies - 16 through 30 (of 36 total)
  • The topic ‘How to rewrite Category Permalink Structure’ is closed to new replies.