Results 1 to 8 of 8

Thread: Previous Next Links in breadcrumbs and ads

  1. #1
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts

    Wink Previous Next Links in breadcrumbs and ads

    Hi,

    this are my two cent for the missing Previous/Next Links in Classipress. I have tested this with my site in the 3.1.8 version and it works and looks very good.

    Here we go with the tutorial:

    1. Add this two functions to the functions.php file of your theme

    PHP Code:
    /**
     * echo the previous_next_links according the settings in the args array.
     * 
     *
     */

    function previous_next_links() {

      if (
    is_singular(APP_POST_TYPE)) {
        
    $args = array (
                       
    'format'                => '%link',
                       
    'linkr'               => '«  %title',
                       
    'linkl'               => '%title »'
                       
    'in_same_cat'         => FALSE,
                       
    'excluded_categories' => '',
                       
    'title_length'        => 38
                       
    );

        echo 
    '<span class="current" style="float:right;"> ';
        echo 
    my_adjacent_post_link($args['format'], $args['linkr'], $args['in_same_cat'], $args['excluded_categories'], true,$args['title_length']);
        echo 
    '&nbsp;&nbsp;';
        echo 
    my_adjacent_post_link($args['format'], $args['linkl'], $args['in_same_cat'], $args['excluded_categories'], false,$args['title_length']);
        echo 
    '</span><p/>';
      }
    }


    /**
     * return a modified version of adjacent post link. Instead to echo it, we return this as a string.
     *
     * Can be either next post link or previous.
     *
     * @since 2.5.0
     * @updated for clasipress by silver
     *
     * @param string $format Link anchor format.
     * @param string $link Link permalink format.
     * @param bool $in_same_cat Optional. Whether link should be in a same category.
     * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs.
     * @param bool $previous Optional, default is true. Whether to display link to previous or next post.
     * @param int $title_length Optional. How long should be the title, in chars
     */
    function my_adjacent_post_link($format$link$in_same_cat false$excluded_categories ''$previous true$title_length=0) {
        if ( 
    $previous && is_attachment() )
            
    $post = & get_post($GLOBALS['post']->post_parent);
        else
            
    $post get_adjacent_post($in_same_cat$excluded_categories$previous);

        if ( !
    $post )
            return;

        
    $title $post->post_title;

        if ( empty(
    $post->post_title) )
            
    $title $previous __('Previous Post') : __('Next Post');

        
    $title apply_filters('the_title'$title$post->ID);
        
    $rel $previous 'prev' 'next';
        
        if (
    $title_length) {
          
    $title=substr($title,0,$title_length);
        }
        
    $string '<a href="'.get_permalink($post).'" rel="'.$rel.'">';
        
    $link str_replace('%title'ucfirst($title), $link);
        
    $link $string $link '</a>';

        
    $format str_replace('%link'$link$format);

        
    $adjacent $previous 'previous' 'next';
        return 
    apply_filters"{$adjacent}_post_link"$format$link );

    2. in the single-ad_listing.php, after the line "appthemes_after_post_content();" (around line 140) add
    this two lines:

    PHP Code:

    <div class="pad2 dotted"></div>
    <?php  previous_next_links();  ?>

    The 3. step is optional, but i have added this also into the theme-functions.php file also to have the links
    in the breadcrumbs line.

    3. find the theme-functions.php and add arround the line 1572 this function call:

    PHP Code:
     // my function from functions.php
     
    previous_next_links(); 
    The end of the cp_breadcrumb function should look like :

    PHP Code:
            // my function from functions.php
            
    previous_next_links(;)
            echo 
    '</div>'

        endif;



    Here are two images, to show how it looks on a live website.

    previous-next-ads.png

    breadcrumbs.jpg

    Regards,
    silver

  2. The Following 2 Users Say Thank You to silver For This Useful Post:

    ggriffin (April 11th, 2012), levt (April 19th, 2012)

  3. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    41,006
    Thanks
    170
    Thanked 3,409 Times in 3,280 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  4. #3
    Senior Member ggriffin's Avatar
    Join Date
    Jan 2012
    Location
    United Kingdom
    Posts
    120
    Thanks
    28
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. The Following 2 Users Say Thank You to silver For This Useful Post:

    ggriffin (April 11th, 2012), villadecker (April 17th, 2012)

  7. #5
    Senior Member ggriffin's Avatar
    Join Date
    Jan 2012
    Location
    United Kingdom
    Posts
    120
    Thanks
    28
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    Veteran levt's Avatar
    Join Date
    Jan 2012
    Location
    Portugal
    Posts
    308
    Thanks
    27
    Thanked 10 Times in 10 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    villadecker's Avatar
    Join Date
    Oct 2010
    Location
    Soest, The Netherlands
    Posts
    192
    Thanks
    22
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!
    Kind regards,

    Frank | Villadecker

  10. #8
    Thread Starter
    Member silver's Avatar
    Join Date
    Mar 2011
    Location
    Germany
    Posts
    78
    Thanks
    11
    Thanked 7 Times in 4 Posts

    New version

    You must be an AppThemes customer and logged in to view this response. Join today!

  11. The Following 2 Users Say Thank You to silver For This Useful Post:

    ggriffin (April 18th, 2012), paulogoode (September 21st, 2014)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [TUTORIAL] While Viewing a Single Ad Use Next & Previous Navigation Links - ENHANCEMENT!
    By vienna in forum ClassiPress General Discussion
    Replies: 83
    Last Post: March 2nd, 2016, 03:58 PM
  2. Microdata Breadcrumbs (Rich Snippets)
    By loker in forum ClassiPress General Discussion
    Replies: 3
    Last Post: February 6th, 2013, 06:40 AM
  3. Managing Breadcrumbs
    By shemeck in forum Report ClassiPress Bugs
    Replies: 2
    Last Post: July 7th, 2012, 01:38 AM
  4. Microdata Breadcrumbs (Rich Snippets)
    By loker in forum Report ClassiPress Bugs
    Replies: 1
    Last Post: February 10th, 2012, 02:42 AM