Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • There seem to be MANY possible causes for this problem — JSCache, the WPLANG setting in wp-config, compression settings, BSD operating system glitch, etc. etc.

    After a day and a half of trying to figure it out, I finally located my particular issue — IT administrator had placed a .htaccess file in the wp-includes folder, which seemed to prevent WP from accessing TinyMCE. Deleted the file and we’re up and running again.

    Just thought I’d put this one out there in case anyone else has the same issue.

    did you ever find a solution to this problem?

    Thread Starter ravirajakumar

    (@ravirajakumar)

    I’ve now also learned that the post2cat table no longer exists, and of course that table was part of my modifications (changing the SELECT to filter based on category if that was required).

    So the bottom line is that I need to be able to do archive lists that group by month or year and that are filtered by category.

    With blogaddress/2008/?cat=8 not working, I’m at a loss as to whether this is even possible anymore. It would be a shame if this valuable feature were gone for good.

    I think I have just re-solved this problem in 2.1.3:

    https://www.ads-software.com/support/topic/86058?replies=4

    Some time ago I came up with a solution to this problem, which was subsequently improved upon by several additional contributors:

    https://www.ads-software.com/support/topic/69776?replies=17

    That code doesn’t work anymore in 2.13, but today I have got it working again, and here is what you need to do:

    1) In wp_get_archives, add:
    ,'mcat' => false
    after the currently last element in the “defaults” array (thanks to youngmicroserf).

    2) Add this elseif code to the list of potential types:

    <br />
      elseif ( 'catmonthly' == $type ) {<br />
    		$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS <code></code>year<code>, MONTH(post_date) AS</code>month

    , count(ID) as posts FROM $wpdb->posts, $wpdb->post2cat WHERE $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = ‘$mcat’ AND $wpdb->posts.post_type = ‘post’ AND $wpdb->posts.post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC” . $limit);
    if ( $arcresults ) {
    $afterafter = $after;
    foreach ( $arcresults as $arcresult ) {
    $url = get_month_link($arcresult->year, $arcresult->month) .”?cat=” .$mcat;
    $text = sprintf(__(‘%1$s %2$d’), $wp_locale->get_month($arcresult->month), $arcresult->year);
    if ( $show_post_count )
    $after = ‘?(‘.$arcresult->posts.’)’ . $afterafter;
    echo get_archives_link($url, $text, $format, $before, $after);
    }
    }
    }

    (Sorry for the long code — pastebin doesn’t seem to be working at the moment)

    The query above will work with version 2.13, but pay attention to the $url construction which uses ‘?cat=’. That assumes that the category filter will be the first argument, which will work if your permalinks are set to “Date and name based”. If you change your permalinks to “Default” you will want to replace ?cat= with &cat= here.

    3) In sidebar.php, replace the existing Archive section with this:

    <br />
    <?php /* Whether this is a category archive */ if (is_category()) { ?></p>
    li><h2>Archives for <?php single_cat_title(''); ?></h2>
    <ul>
    				<?php $catmonthquery = ("type=catmonthly&mcat=" .($cat)); wp_get_archives($catmonthquery); ?>
    				</ul>
    /li>
    <p>			<?php </p>
    <p>			} else { ?></p>
    li><h2>Archives</h2>
    <ul>
    				<?php wp_get_archives('type=monthly'); ?>
    				</ul>
    /li>
    <p>			<?php } ?><br />

    That all should work correctly — when you are looking at a single category, the archive navigation will only list months with entries for that category and the links will show archives that are filtered for that category.

    BONUS: It also occurred to me that when looking at a single post, one might want to modify the archive navigation so that it shoes a separate archive for each category of which that post is a member. To do that, just insert this in the middle of the sidebar code above:

    <br />
    <?php } elseif (is_single()) {<br />
    	foreach((get_the_category()) as $cat) { ?></p>
    li><h2>Archives for <?php echo $cat->cat_name . ' '; ?></h2>
    <ul>
    		<?php $catmonthquery = ("type=catmonthly&mcat=" .($cat->cat_ID)); wp_get_archives($catmonthquery); ?>
    	</ul>
    /li>
    <p>

    It goes right after the first li.

    Hope that all is helpful and that people who need it can find this thread.

Viewing 5 replies - 1 through 5 (of 5 total)