WordPress & PHP - Next / Previous Page Function -
WordPress & PHP - Next / Previous Page Function -
basically i'm creating website , used plugin called animescrape, can't find much back upwards question , i've been unsuccessful few days i'm hoping here help me.
here page looks like:
--warning -> page contains lot of ads, enable adblock--
http://safari-zone.com/anime/dragon-ball-z-episode-291/
as can see next/previous post buttons wrong, link totally different episodes , pages.
so, beingness said want create them link proper page.
here function told use:
function get_episode_link( $series, $epnum, $subdub ){ $args = array( 'post_type' => 'anime', 'series' => $series, 'meta_key' => 'episode_num', 'meta_value' => $epnum, 'post_status' => 'publish' ); $my_query = new wp_query( $args ); if($my_query->have_posts() ) : while($my_query->have_posts() ) : $my_query->the_post(); $_ep = get_post_meta( get_the_id(), 'episode_data', true ); if( $subdub == $_ep->epnum_int ){ $link['title'] = get_the_title(); $link['permalink'] = post_permalink( get_the_id() ); wp_reset_postdata(); homecoming $link; } endwhile; endif; wp_reset_postdata(); homecoming null; }
then told need declare function on template, page i've been using single-anime.php i'm unsure of add together code.. here page template:
<?php /** * @package parament */ get_header(); ?> <div id="container" class="contain"> <div id="main" role="main"> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : ?> <?php the_post(); ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php comments_template(); ?> <?php else : ?> <?php get_template_part( 'content', '404' ); ?> <?php endif; ?> </div><!-- end main --> <?php get_sidebar(); ?> </div><!-- end container --> <?php get_footer(); ?>
but it's possible using wrong page, if allow me know guys think.
$5 paypal whoever can prepare :p
php wordpress function next
Comments
Post a Comment