• Resolved Elmarie

    (@elmarie)


    Good day

    How can I change this code to display the post ID after the title instead of the date & time?

    function usp_customize_default_title($title, $time) {
    return $title .’ – ‘. $time;
    }
    add_filter(‘usp_default_title’, ‘usp_customize_default_title’, 10, 2);

    Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Try this should work:

    function usp_customize_default_title($title, $time) {
    	global $post;
    	return $title .' – '. $post->ID;
    }
    add_filter('usp_default_title', 'usp_customize_default_title', 10, 2);
    Thread Starter Elmarie

    (@elmarie)

    Hi Jeff

    Thank you for your quick reply. I tried this before but it’s not working.

    This is the result: User Submitted Post –

    No post id.

    Thanks.

    Plugin Author Jeff Starr

    (@specialk)

    Ah good catch.. it is not possible to display the post ID using that hook because the post has yet to be created at that point.

    Thread Starter Elmarie

    (@elmarie)

    Thought so – thank you. Just wanted to make sure I’m not missing anything.

    Do you know if there is any way just to add a number after the post title. So I start with nr 1 and increment the number with 1 every time a new post is created?

    Thanks

    Plugin Author Jeff Starr

    (@specialk)

    Not without significant modifications and custom code, etc.

    May I ask why you want to append a number to post titles?

    Thread Starter Elmarie

    (@elmarie)

    I want to make the titles generic for example: Request #1, Request #2 etc. and not use user submitted titles.

    Plugin Author Jeff Starr

    (@specialk)

    Not possible with the free version. Pro version has an option to use “YOUR TEXT HERE” for the title, and then WP handles all of the dash-numbering automatically. We’re not allowed to discuss pro versions here though, so if you have any questions please reach us using the contact form at Plugin Planet, thank you.

    Thread Starter Elmarie

    (@elmarie)

    Thank you. I’ll have a look at the pro version.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Post Title’ is closed to new replies.