Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there! Could you elaborate on how you did this? I’ve been hunting for this kind of feature and this is the most promising thing I’ve heard yet. 🙂 Thanks in advance!

    Alex

    Thread Starter digitaleyecandy

    (@digitaleyecandy)

    First, backup your original files. Keep in mind that if/when the plug-in gets updated, it’ll undo all these changes.

    Then try the following changes to compact.php

    Add the variable in line 78 from this:
    $result = utf8_encode( get_compact_archive( $style, $before, $after ) );

    To this:
    $result = utf8_encode( get_compact_archive( $style, $before, $after, $category ) );

    Change the query in line 105 from this:
    $results = $wpdb->get_results( "SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month FROM " . $wpdb->posts . " WHERE post_type='post' AND post_status='publish' AND post_password='' ORDER BY year DESC, month DESC" );

    To this:

    $results = $wpdb->get_results( "SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month FROM  " . $wpdb->posts . " WHERE post_type='post' AND post_status='publish' AND post_password='' AND ID IN (
              SELECT object_id FROM wp_term_relationships WHERE term_taxonomy_id IN (
                SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE taxonomy = 'category' AND term_id IN (
                          SELECT t.term_id  FROM wp_terms t WHERE t.slug IN ('" . $category . "')
                )
              ) 
           )
    
          ORDER BY year DESC, month DESC" );

    Change the RESULTS section, on line 137 from this:
    $result .= '<a href="' . get_month_link( $year, $month ) . '" title="' . $month_name . ' ' . $year . '">' . $month_abbrev . '</a> ';

    To this:
    $result .= '<a href="/index.php?category_name=' . $category . '&year=' . $year . '&monthnum=' . $month . '" title="' . $month_name . ' ' . $year . '">' . $month_abbrev . '</a> ';

    Update the Shortcode section line 164 from this:
    $string = $wrap . get_compact_archive( $style, $before, $after ) . $wrap_end;

    To this:
    $string = $wrap . get_compact_archive( $style, $before, $after, $category ) . $wrap_end;

    That’s it.

    • This reply was modified 4 years, 8 months ago by digitaleyecandy. Reason: code formatting
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Quick and simple plugin’ is closed to new replies.