Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Glad that worked for your blacloch.

    @tfleming and drchrisheard – if at all possible, I avoid editing core files. In the case of upgrading, you’ll have to reapply the fix to the post.php file.

    Saw a lot of posts asking the same thing with no reply. I figured it out, so here’s my solution. In my functions.php file for the template I made a small tweak to how the_title function works. Copy and paste the two functions into your functions.php file and replace all instances of the_title() with asv_the_title(). All other functionality of the_title() should still remain the same.

    function asv_the_title($before = '', $after = '', $echo = true) {
    	$title = asv_get_the_title();
    	if ( strlen($title) > 0 ) {
    		$title = apply_filters('the_title', $before . $title . $after, $before, $after);
    		if ( $echo )
    			echo $title;
    		else
    			return $title;
    	}
    }
    
    function asv_get_the_title($id = 0) {
    	$post = &get_post($id);
    
    	$title = $post->post_title;
    
    	return $title;
    }

    Thread Starter variaas

    (@variaas)

    Saw a lot of posts asking the same thing with no reply. I figured it out, so here’s my solution. In my functions.php file for the template I made a small tweak to how the_title function works. Copy and paste the two functions into your functions.php file and replace all instances of the_title() with asv_the_title(). All other functionality of the_title() should still remain the same.

    function asv_the_title($before = '', $after = '', $echo = true) {
    	$title = asv_get_the_title();
    	if ( strlen($title) > 0 ) {
    		$title = apply_filters('the_title', $before . $title . $after, $before, $after);
    		if ( $echo )
    			echo $title;
    		else
    			return $title;
    	}
    }
    
    function asv_get_the_title($id = 0) {
    	$post = &get_post($id);
    
    	$title = $post->post_title;
    
    	return $title;
    }
Viewing 3 replies - 1 through 3 (of 3 total)