Hope you doing fine.
I am back again with wordpress stuff.
Some times, we need to list all category(terms) in one page.for that,it is really easy to do by function get_terms()
But problem is we need list with Pagination 😀 , For that we have to pass parameter offset and number in get terms function and that’s it..!
Here is Code:
if ( get_query_var( ‘paged’ ) )
$paged = get_query_var(‘paged’);
else if ( get_query_var( ‘page’ ) )
$paged = get_query_var( ‘page’ );
$paged = 1;
$per_page = 2;
$number_of_series = count( get_terms( ‘mycategory’,array(‘hide_empty’=>’0’) ) );
$offset = $per_page * ( $paged – 1) ;
// Setup the arguments to pass in
$args = array(
‘offset’ => $offset,
‘number’ => $per_page,
// Gather the series
$mycategory = get_terms( ‘mycategory’, $args );
// Loop through and display the series
foreach($series as $s)
$theurl = get_term_link($s, ‘mycategory’);
echo “<div class=\”ser-img img\” ><a href=\”” . $theurl . “\”>”. $s->name .”</a>”;
echo “<br />”;
$big = 999999;
echo paginate_links( array(
‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
‘format’ => ‘?paged=%#%’,
‘current’ => $paged,
‘total’ => ceil( $number_of_series / $per_page ) // 3 items per page
Posted: October 14, 2015 in Uncategorized
Tags: multilanguage, wordpress
In multilanguage website,generally when user click in language flag, all website content transaltes into perticular language.
for that purpose,we need to give many page title section and page content section as per number of language.It is done by plugin called Qtranslate,further more If we want to change meta field for each language we need use Plugin called (1) ACF and (2) ACF qtranslate
plugin that need to install:qtranslate,ACF(Advance Custom Field)
After installed plugins,
qtranslate:Add languages as per your requirement.For example 1.English(Language code:en) 2.Thailand(th). After add language we need to add post that has title and content in both language.
ACF : We need to add meta field for post or page.So, Let’s take Example:meta_key is ‘my_meta_key’.
Now after added single post in both language.we need to filter that post in front-end: means changes in code 🙂
The post content will automatically change as per language change.
Now for post meta, here is code
$arr=get_field( ‘pg_header’, $post->ID, true );
For more :
echo _e($term->description, ‘qtranslate’);
$content = apply_filters(‘the_content’, $about_us->post_content);
Posted: September 19, 2015 in Uncategorized
Tags: auto draft, wordpress
After admin login, when we go to wp-admin/post-new.php (for add new post) At that time one row in database is created.
and the entry was include new post id and post status is auto-draft.
And when we again refresh the page, none more row is created with new post id and post status