Make WordPress Core

Ticket #1835: 1835.diff

File 1835.diff, 987 bytes (added by johnbillion, 18 years ago)

Patch to display 'Previous Post' or 'Next Post' when no post title is specified

  • link-template.php

     
    387387        if ( !$post )
    388388                return;
    389389
    390         $title = apply_filters('the_title', $post->post_title, $post);
     390        $title = $post->post_title;
     391
     392        if ( empty($post->post_title) )
     393                $title = 'Previous Post';
     394
     395        $title = apply_filters('the_title', $title, $post);
    391396        $string = '<a href="'.get_permalink($post->ID).'">';
    392397        $link = str_replace('%title', $title, $link);
    393398        $link = $pre . $string . $link . '</a>';
     
    403408        if ( !$post )
    404409                return;
    405410
    406         $title = apply_filters('the_title', $post->post_title, $post);
     411        $title = $post->post_title;
     412
     413        if ( empty($post->post_title) )
     414                $title = 'Next Post';
     415
     416        $title = apply_filters('the_title', $title, $post);
    407417        $string = '<a href="'.get_permalink($post->ID).'">';
    408418        $link = str_replace('%title', $title, $link);
    409419        $link = $string . $link . '</a>';