[wp-pro] will pay to have template modified for the 'older
articles' display
SHAWN GAFFNEY
imtiedup at hotmail.com
Sat Oct 25 18:23:40 GMT 2008
The theme I am using 'one-theme' looks nice but there is a major problem with it. When a user clicks the 'older' button, for listing older articles not displayed on the homepage, pagination, the next pages show up but you still have the same template file used for the older pages.
In other words, you are still presented with the feature article and featured categories above the older articles. This really confused the readers because they think they are on the same page enless they scroll down the page.
I need to modify in the code below to have wordpress change the template page for all the 'older' pages when the button is clicked.
Just let me know how much you want and how long it will take.
thank you
shawn
imtiedup at hotmail.com
--code
function ot_paginate() { // Some info global $paged; $on_page = intval($paged); $no_prev = false; $no_next = false; // Fix page if ($on_page == 0) { $on_page = 1; } // Get the max number of pages global $wp_the_query; $max_pages = $wp_the_query->max_num_pages; // Are we near the start? $start_pos = $on_page - 2; if ($start_pos <= 0) { $amt_from_zero = ($start_pos * $start_pos) + 1; // to account for 0 $start_pos = 1; } // Are we near the end? $end_pos = $on_page + 2; if ($end_pos >= $max_pages) { $amt_from_end = $end_pos - $max_pages; $end_pos = $max_pages; } // How does this affect the range? if (isset( $amt_from_zero ) && isset( $amt_from_end )) { // Leave them both alone } elseif(isset( $amt_from_zero )) { // try and add the remainder on to the end_pos $end_pos = $end_pos + $amt_from_zero; if ($end_pos >= $max_pages) { $end_pos = $max_pages; } } elseif(isset( $amt_from_end )) { // try and subtract the remainder from the start_pos $start_pos = $start_pos - $amt_from_end; if ($start_pos <= 0) { $start_pos = 1; } } // Sort out next and prev if (($on_page - 1) <= 0) $no_prev = true; if (($on_page + 1) > $max_pages) $no_next = true; // How many pages do we have? $links_to_print = ($end_pos - $start_pos) + 1; // print the list echo '<div id="pagination">' . "\n"; echo '<ul>' . "\n"; echo '<li class="extreme"><a href="' . clean_url(get_pagenum_link(1)) . '">«</a></li>'; echo $no_prev ? '<li class="inactive">' . ot_lang( 'newer' ) . '</li>' : '<li><a href="' . clean_url(get_pagenum_link($on_page - 1)) . '">' . ot_lang( 'newer' ) . '</a></li>'; for ($i = $start_pos; $i <= $end_pos; $i++) { if ($i == $on_page) { echo '<li class="active">'; } else { echo '<li>'; } echo '<a href="' . clean_url(get_pagenum_link($i)) . '">' . $i . '</a></li>'; } echo $no_next ? '<li class="inactive">' . ot_lang( 'older' ) . '</li>' : '<li><a href="' . clean_url(get_pagenum_link($on_page + 1)) . '">' . ot_lang( 'older' ) . '</a></li>'; echo '<li class="extreme"><a href="' . clean_url(get_pagenum_link($max_pages)) . '">»</a></li>'; echo '</ul>' . "\n"; echo '</div>' . "\n"; }
_________________________________________________________________
When your life is on the go—take your life with you.
http://clk.atdmt.com/MRT/go/115298558/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://comox.textdrive.com/pipermail/wp-pro/attachments/20081025/ed793d4a/attachment.htm
More information about the wp-pro
mailing list