Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('navigation_markup_template', 'my_navigation_template', 10, 2 );
- function my_navigation_template( $template, $class ){
- return '<div class="pagination" id="my-form-pagination"><ul>%3$s</ul></div>';
- }
- function cars_pagination(){
- $args = array(
- 'mid_size' => 1,
- 'prev_next' => true
- );
- $nav = get_the_posts_pagination( $args );
- echo $nav;
- ?>
- <div id="form-container" style="display: none"></div>
- <script>
- jQuery( document ).ready( function() {
- jQuery('#my-form-pagination ul li a').click(function(event) {
- event.preventDefault();
- var href = jQuery(this).attr( "href" );
- var obj = <?=json_encode($_POST)?>;
- jQuery('#form-container').append( jQuery('<form />', { action: href, method: 'POST' }));
- for (var prop in obj) {
- jQuery('#form-container form').append(
- jQuery('<input />', { name: prop , type: 'hidden', value: obj[prop] })
- );
- }
- jQuery('#form-container form').submit();
- });
- });
- </script>
- <?php
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement