Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hello, I am able to show the title of the Next and Previous posts using this code:
Code: Select all
  <cms:php>
                  global $CTX;
                  $page_ids = explode( ",", "<cms:pages ids_only='1' />" );
                  $cur_page_id = "<cms:show k_page_id />";
                 $pos = array_search( $cur_page_id, $page_ids );
                  if( $pos!==FALSE ){
                  if( $pos>0 ){
                     // Prev page id
                     $prev_page_id = $page_ids[$pos-1];
                     $CTX->set( 'prev_page_id', $prev_page_id, 'global' );
                  }
                  if( $pos<count($page_ids)-1 ){
                     // Next page id
                     $next_page_id = $page_ids[$pos+1];
                    $CTX->set( 'next_page_id', $next_page_id, 'global' );
                  }
                  }
            </cms:php>
            <cms:if prev_page_id >
                  <cms:pages id=prev_page_id skip_custom_fields='1'>
                  <a href="<cms:show k_page_link />"><i class="fa fa-angle-left"></i> <cms:get_custom_field 'text_for_previous_article' masterpage='globals.php' /></a>
                  </cms:pages>
            </cms:if>
            <cms:if next_page_id >
              <cms:pages id=next_page_id skip_custom_fields='1'>
                  <a href="<cms:show k_page_link />"><cms:get_custom_field 'text_for_next_article' masterpage='globals.php' /> <i class="fa fa-angle-right"></i></a>
               </cms:pages>
            </cms:if>

Now I want to be able to show the Title, Image of post and an excerpt of the next or previous posts as seen in the image below:
Bottom of news page.jpg
Bottom of news page.jpg (244.74 KiB) Viewed 142 times
.
How do I go about it? Thanks in advance
Hi,

In the mentioned solution you'll find two blocks of <cms:pages> (one for previous page and the other for next).
Please remove the skip_custom_fields='1' directive from both. Now all your custom fields (editable regions) will be available for use within those two blocks as per usual.

Hope it helps.
Thanks KK. Will try that out and let you know the outcome. :D
Yeeeeeeepeee, KK it worked Thanks so much
4 posts Page 1 of 1

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests