Ane lagi latihan buat web dengan menggunakan cms wordpress. Ane lagi latihan buat custom post type dengan menggunakan plugin custom post type plugin ui wordpress. Custom post typenya sudah mau tampil dengan baik dan tanpa masalah tapi ane pingin nambahin paging dipostnya biar terlihat lebih bagus. Ane udah coba codingan di internet tapi pagingnya gak mau muncul gan. Berikut coding ane :
Code:
<?php
/**
* Template Name: Film Barat
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
<body>
<div id="container">
<div id="header">
<h1 class="blogtitle"><?php bloginfo('name');?></h1>
<p class="description"><?php bloginfo('description');?></p>
</div>
<div id="menu">
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div>
<div id="content">
<div id="contentkiri" class="block">
<?php query_posts( 'post_type=film'); ?>
<?php if ( have_posts() ) : ?>
<?php /*while ( have_posts() ) : the_post();*/ ?>
<!--coba-->
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$query = new WP_Query( array(
'post_type' => 'film',
'posts_per_page' => 5,
'paged'=>$paged
) ); ?>
<!--endcoba-->
<?php /*$query = new WP_Query( array('post_type' => 'film', 'posts_per_page' => 5 ) );*/
while ( $query->have_posts() ) : $query->the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<p><?php the_content('Baca Selengkapnya'); ?></p>
<br />
<div id="postmeta">Publish on <?php the_time('F jS, Y'); ?> under <?php the_category(', '); ?> by <?php the_author(); ?> |
<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
<?php edit_post_link('Edit','','|'); ?></div>
<br />
</div>
<?php comments_template(); ?>
<?php /*endwhile;*/?>
<?php /*endif;*/?>
<?php endwhile; ?>
<?php previous_posts_link(); ?>
<?php next_posts_link(); ?>
<?php endif; wp_reset_postdata(); ?>
</div>
<div id="contentkanan" class="block">
<?php if ( is_active_sidebar( 'contentkanan-atas' ) ) : ?>
<div id="atas">
<ul>
<?php dynamic_sidebar( 'contentkanan-atas' ); ?>
</ul>
</div>
<?php endif; ?>
<div id="kiri">
<ul>
<?php if ( ! dynamic_sidebar( 'contentkanan-kiri' ) ) : ?>
<li id="search" class="widget-container widget_search">
<?php get_search_form(); ?>
</li>
<li id="archives" class="widget-container">
<h3 class="widget-title">Arsip</h3>
<ul>
<?php wp_get_archives( 'type=monthly' ); ?>
</ul>
</li>
<?php endif; ?>
</ul>
</div>
<div id="kanan">
<ul>
<?php if ( ! dynamic_sidebar( 'contentkanan-kanan' ) ) : ?>
<li id="meta" class="widget-container">
<h3 class="widget-title">Meta</h3>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<?php wp_meta(); ?>
</ul>
</li>
<?php endif; ?>
</ul>
</div>
</div>
</div>
<?php get_footer(); ?>