Hello, I am using the smart-archives plugin and I need that when the user click on a month all the posts from that month would be directly displayed (not a list with the titles, but the complete posts). I have seen in another tag, titled:
[Plugin: Smart Archives Reloaded] Remove the link to the monthly archive in fancy archive
it is this issue commented. I have copied that code:
/ The "fancy" archive
protected function generate_fancy() {
$months_long = $this->get_months();
$year_list = html("ul class='tabs year-list'",
$this->generate_year_list()
, "\n");
$block = '';
foreach ( $this->yearsWithPosts as $year ) {
// Generate top panes
$months = html("ul id='month-list-$year' class='tabs month-list'",
$this->generate_month_list($year)
, "\n\t");
// Generate post lists
$list = '';
for ( $i = 1; $i <= 12; $i++ ) {
if ( ! $current = @$this->monthsWithPosts[$year][$i] )
continue;
// Append to list
$list .= html('div class="pane"',
"\n\t\t" . html('h2 class="month-heading"',
"$months_long[$i] $year "
.html('span class="month-archive-link"',
'('. html_link($current['link'], __('View complete archive page', 'smart-archives-reloaded')) .')'
)
)
.html('ul class="archive-list"',
$this->generate_post_list($current['posts'], "\n\t\t\t")
, "\n\t\t")
, "\n\t");
} // end month block
$block .= html('div class="pane"', $months . $list, "\n");
} // end year block
// Wrap it up
return html('div id="smart-archives-fancy"', $year_list . $block);
}
but it does not work, I think that it is because I have to modify this code too:
//_____HELPER TEMPLATES_____
protected function generate_year_list( $current_year = 0 ) {
$year_list = '';
foreach ( $this->get_years_with_posts( 'asc' ) as $year ) {
$year_list .=
html( 'li',
$this->a_link( get_year_link( $year ), $year, $year == $current_year )
);
}
return $year_list;
}
protected function generate_month_list( $year, $current_month = 0, $inline = false ) {
$month_names = $this->get_months( $this->args->month_format );
$in_current_year = ( get_query_var( 'year' ) == $year );
$month_list = '';
foreach ( range( 1, 12 ) as $i ) {
$month = $month_names[$i];
if ( in_array( $i, $this->get_months_with_posts( $year ) ) ) {
$url = $this->args->anchors ? "#{$year}{$i}" : get_month_link( $year, $i );
$tmp = $this->a_link( $url, $month, $in_current_year && $i == $current_month );
}
else {
$tmp = html( 'span class="empty-month"', $month );
}
if ( $inline )
$month_list .= " $tmp";
else
$month_list .= "\n\t\t" . html( 'li', $tmp );
}
return $month_list;
}
protected function generate_post_list( $year, $i, $indent ) {
$posts = $this->get_posts( $year, $i );
if ( empty( $posts ) )
return false;
$post_list = '';
foreach ( $posts as $post ) {
$list_item = $this->args->list_format;
foreach ( SAR_Core::get_available_tags() as $tag )
if ( false !== strpos( $this->args->list_format, $tag ) )
$list_item = str_replace( $tag, call_user_func( array( $this, 'substitute_' . substr( $tag, 1, -1 ) ), $post ), $list_item );
$post_list .= $indent . html( 'li', $list_item );
}
return $post_list;
}
protected function get_months( $format = 'long' ) {
global $wp_locale;
$months = array();
foreach ( range( 1, 12 ) as $i ) {
if ( 'numeric' == $format ) {
$months[$i] = zeroise( $i, 2 );
continue;
}
$month = $wp_locale->get_month( $i );
if ( 'short' == $format )
$month = $wp_locale->get_month_abbrev( $month );
$months[$i] = esc_html( $month );
}
return $months;
}
protected function a_link( $link, $title, $current ) {
$el = $current ? 'a class="current"' : 'a';
return html( $el . ' href="' . $link . '"', $title );
}
I do not know too much php code, so I be someone to help me.
Many thanks