Administración de Sistemas

Items filtered by date: Noviembre 2018

El texto original está aquí

https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/#implementation

1) Crear una plantilla Repeater Template

 

 

2) Insertar en single.php el siguiente código: 

<?php
// Our single template (single.php)
// Replace the entire contents of the WordPress loop with the [ajax_load_more] shortcode.
// https://connekthq.com/plugins/ajax-load-more/add-ons/previous-post/
?>
<?php get_header(); ?>
 
<main id="page-content">
  <div class="post-container">
    <?php
    // The loop
    if ( have_posts() ) :
      while (have_posts() ) : the_post();
        // replaced with Ajax Load More shortcode
        echo do_shortcode('[ajax_load_more post_type="post" repeater="default" previous_post="true" previous_post_id="'. get_the_ID() .'" posts_per_page="1" button_label="Previous Post"]');
      endwhile;
    endif;
    ?>
  </div>
</main>
 
<?php get_footer(); ?>
 
------------------------------------------------------------------------
Más ejemplos para excluir posts
https://connekthq.com/plugins/ajax-load-more/docs/code-samples/exclude-posts/
Published in Wordpress

Se puede  utilizar la función 

get_the_category():

$categories = get_the_category();

$category_id = $categories[0]->cat_ID;

Published in Wordpress