Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have archive links in my theme that get the archives for a specfic category ('blog) like so:

 <?php wp_get_archives('cat=6'); ?>

When i click on the link for the archives is just loads the category page again for the blog.

The url does change to:

http://localhost:8888/2012/11/?cat=6

But nothing changes on the page.

share|improve this question
    
That is an odd mix of pretty permalinks and default (straight PHP) permalinks. What setting do you have in wp-admin->Settings->Permalinks? –  s_ha_dum Nov 7 '12 at 15:03
    
/%category%/%postname%/ –  Chris Nov 7 '12 at 15:04
    
Which field? "Custom Structure"? Does other URL rewriting work? What is the server (Apache, IIS, etc.) what is the OS of the server? –  s_ha_dum Nov 7 '12 at 15:08
    
custom structure, server is apache and linux. On my category page I have it split with if statements to show the posts different depending if its in the blog section or work section. I wonder if this has something to do with it. But i cannot find where the archive code is. –  Chris Nov 7 '12 at 15:11
add comment

1 Answer 1

OK. Here is your problem.

wp_get_archives( $args );
...
$args = array(
    'type'            => 'monthly',
    'limit'           => ,
    'format'          => 'html', 
    'before'          => ,
    'after'           => ,
    'show_post_count' => false,
    'echo'            => 1
);

You are use wp_get_archives incorrectly. That function accepts particular 'keys', and cat isn't one of them. You can use an array as above or the weird get-like string that is common in WordPress. You can't pass it values it isn't meant to handle though.

What you are seeing is the function fall back to its 'monthly' archive default, and apparently append your string to the end, which I wouldn't have expected.

Use get_category_link instead.

share|improve this answer
    
Ok, This has now started to work. But, how would I get archives from a certain cat? –  Chris Nov 7 '12 at 15:27
    
Use get_category_link; see my answer. –  s_ha_dum Nov 7 '12 at 15:29
    
Ok, but how can i filter these monthly? –  Chris Nov 7 '12 at 15:31
    
I don't know of a function that will do that. Of course you can start filtering WP_Query –  s_ha_dum Nov 7 '12 at 15:38
    
Sorry, what i mean is, when I click 'October'. How do i see all the posts from October? right now i just see one post, I need to see each post. –  Chris Nov 7 '12 at 15:39
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.