Support » Fixing WordPress » Hooking a custom title to a custom post

  • Hey guys,

    I’ll try to make this as understandable as possible. I have a custom post with the unique identifier ‘custom_version’. These posts will post versions of an application’s update (kinda like changelog).

    I need a custom title for posts under this custom post type. In the title field, I just want to post the version number only; eg: 1.0.0. The output that I want needs to be a standard; eg: “Application Name v1.0.0”.

    I would post this as:
    <h1>Application Name v<?php the_title(); ?></h1>

    However, this will only reflect in the sections where its customized. For example, in the recent posts widget, it will only show as “1.0.0”. I want the title to be totally customized for the particular custom post. I tried google and think this can be achieved using wp_title “hooks” but I’m really not an advanced developer and have no idea on how to use that.

    Help is greatly appreciated.

    Cheers~

Viewing 4 replies - 1 through 4 (of 4 total)
  • Okay, Here’s an update..
    I’ve got this so far..

    add_filter('the_title', 'new_title');
    function new_title($title) {
    	global $post, $post_ID;
    	$title['custom_version'] = 'Application Name v'.$title;
    	return $title;
    }

    But its not fully working. Any ideas guys?

    Anyone? I know I’m just missing a small glitch here. Someone enlighten me please?

    I tried this..But it changed ALL titles instead of only those contained under ‘custom-version’..

    add_filter('the_title', 'new_title');
    function new_title($title) {
    	global $post, $post_ID;
    	if(is_singular('custom_version')):
    	return 'Application Name v'.$title;
    	else:
    	return $title;
    	endif;
    }

    Anyone here can help??

    Seriously guys, anyone? This is driving me nuts~

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hooking a custom title to a custom post’ is closed to new replies.