Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27796

    Is there a way to add this feature to pages as well? It is very cool.

    Thanks

    #135388

    Hi,

    Edit template-builder.php, find this code:

    echo " </div><!--end builder template-->";

    Below, add this code:

    $pagelist = get_pages('sort_column=menu_order&sort_order=asc');
    $pages = array();
    foreach ($pagelist as $page) {
    $pages[] += $page->ID;
    }

    $current = array_search(get_the_ID(), $pages);
    $prevID = $pages[$current-1];
    $nextID = $pages[$current+1];
    ?>

    <?php if (!empty($prevID)) { ?>
    <a class="avia-post-nav avia-post-prev without-image" href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a>
    </a>
    <?php }
    if (!empty($nextID)) { ?>
    <a class="avia-post-nav avia-post-next without-image" href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a>
    <?php } ?>

    Edit page.php, find this code:

    $avia_config['size'] = avia_layout_class( 'main' , false) == 'entry_without_sidebar' ? '' : 'entry_with_sidebar';
    get_template_part( 'includes/loop', 'page' );
    ?>

    Add this:

    <?php $pagelist = get_pages('sort_column=menu_order&sort_order=asc');
    $pages = array();
    foreach ($pagelist as $page) {
    $pages[] += $page->ID;
    }

    $current = array_search(get_the_ID(), $pages);
    $prevID = $pages[$current-1];
    $nextID = $pages[$current+1];
    ?>

    <?php if (!empty($prevID)) { ?>
    <a class="avia-post-nav avia-post-prev without-image" href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a>
    </a>
    <?php }
    if (!empty($nextID)) { ?>
    <a class="avia-post-nav avia-post-next without-image" href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a>
    <?php } ?>

    It doesn’t look exactly like the post nav but the it works.

    Regards,

    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘Posts – Side screen navigation’ is closed to new replies.