I need a plugin to paginate tags in the cloud. Not more than 30 tags per page.
Website http://umafrase.com
If not exist this plugin that I want, there is someone to make? tell me your email address.
Francisco Javier Carazo Gil answers:
Maybe there is a better solution than pagination:
http://wordpress.org/extend/plugins/configurable-tag-cloud-widget/
http://wordpress.org/extend/plugins/nktagcloud/
Jose Ribeiro comments:
No one of these plugins make pagination!
Manoj Raj answers:
You can just make use of the jquery plugins for pagination.. It will be very easy as well...
http://www.jquery4u.com/plugins/10-jquery-pagination-plugins/
http://cssglobe.com/post/9801/easy-paginate-jquery-plugin-for-pagination/
http://tympanus.net/codrops/2009/11/17/jpaginate-a-fancy-jquery-pagination-plugin/
Manoj Raj comments:
Take the following jquery plugin as example
http://luis-almeida.github.com/jPages/
add the following to head
<script type="text/javascript" src="http://luis-almeida.github.com/jPages/js/jPages.js"></script>
<script type="text/javascript">
jQuery(function() {
jQuery("li#better-tag-cloud").after('<div class="pagin"></div>');
/* initiate plugin */
jQuery(".pagin").jPages({
containerID: "better-tag-cloud",
perPage : 5
});
});
</script>
I have just made a rough layout.. You can add css and explore other options to it later...
Yoyo Sunaryo answers:
try this code...
<?php
// if show all is set
if( isset($_GET['paged']) ):
$args = array( 'hide_empty' => 0 );
else:
// else show paged
$page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
// number of tags to show per-page
$per_page = 30;
$offset = ( $page-1 ) * $per_page;
$args = array( 'number' => $per_page, 'offset' => $offset, 'hide_empty' => 0 );
endif;
$taxonomy = 'post_tag';
$tax_terms = get_terms( $taxonomy, $args );
echo '<ul>';
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
echo '</ul>';
// pagination
// if showall isn't set
if( !isset($_GET['showall']) ):
$total_terms = wp_count_terms( 'post_tag' );
$pages = ceil($total_terms/$per_page);
// if there's more than one page
if( $pages > 1 ):
echo '';
for ($pagecount=1; $pagecount <= $pages; $pagecount++):
echo '<a href="'.get_permalink().'page/'.$pagecount.'/">'.$pagecount.'</a> |';
endfor;
echo '';
// link to show all
// echo '<a href="'.get_permalink().'?showall=true">show all</a>';
endif;
else:
// showall is set, show link to get back to paged mode
// echo '<a href="'.get_permalink().'">show paged</a>';
endif;
?>
<strong>example: use Twenty Ten theme by the WordPress team</strong>
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
// if show all is set
if( isset($_GET['paged']) ):
$args = array( 'hide_empty' => 0 );
else:
// else show paged
$page = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
// number of tags to show per-page
$per_page = 40;
$offset = ( $page-1 ) * $per_page;
$args = array( 'number' => $per_page, 'offset' => $offset, 'hide_empty' => 0 );
endif;
$taxonomy = 'post_tag';
$tax_terms = get_terms( $taxonomy, $args );
echo '<ul>';
foreach ($tax_terms as $tax_term) {
echo '<li>' . '<a href="' . esc_attr(get_term_link($tax_term, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a></li>';
}
echo '</ul>';
// pagination
// if showall isn't set
if( !isset($_GET['showall']) ):
$total_terms = wp_count_terms( 'post_tag' );
$pages = ceil($total_terms/$per_page);
// if there's more than one page
if( $pages > 1 ):
echo '';
for ($pagecount=1; $pagecount <= $pages; $pagecount++):
echo '<a href="'.get_permalink().'page/'.$pagecount.'/">'.$pagecount.'</a> |';
endfor;
echo '';
// link to show all
// echo '<a href="'.get_permalink().'?showall=true">show all</a>';
endif;
else:
// showall is set, show link to get back to paged mode
// echo '<a href="'.get_permalink().'">show paged</a>';
endif;
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>