[Support request] A way to show unique id in front of the title of every post ?

Home Forums Support [Support request] A way to show unique id in front of the title of every post ?

Home Forums Support A way to show unique id in front of the title of every post ?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #2360959
    priyankeshu

    is there a way to show unique ID in the TITLE suffix so it is easy to identify the posts?
    let me know!
    thanks!

    #2360994
    Fernando
    Customer Support

    Hello Priyankeshu,

    For reference, can you provide a link to a post in your site?

    #2362126
    priyankeshu

    http://www.thinkovert.com

    something similar to this
    https://generatepress.com/forums/topic/how-to-suffix-or-prefix-the-post-title-in-elements/#post-730638

    i don’t know if ELEMENTS is the way to show it?

    basically i want post titles to go like

    UID – Post title – CUSTOMPOSTTAG/category
    example-
    765 – How to think about dreams – R1 –

    #2362141
    Fernando
    Customer Support

    I see. Try adding this PHP:

    add_filter( 'generate_get_the_title_parameters', function($params){
    	
    	$params['before'] = '<h1>' . get_the_ID() . '</h1> - ' . $params['before'];
    	return $params;
    },10);

    Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2363821
    priyankeshu

    hello thanks
    i tried and it seems to work, but now the title is going in new line

    something like

    2856
    TITLE GOES HERE

    i want something like this

    2856 – TITLE GOES HERE – DATE – TAG

    also can you suggest how can i customize the code snippet to add TAGs/Categories or CUSTOMCategories in it?

    thank you , really appreciate this!

    #2364613
    Fernando
    Customer Support

    Can you share the link to the site in question? We might need to add some custom CSS to address this.

    You may use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    #2364617
    priyankeshu

    hi, i had shared it above,

    http://www.thinkovert.com

    #2364752
    Fernando
    Customer Support

    Change the snippet to this:

    add_filter( 'generate_get_the_title_parameters', function($params){
    	
    	$params['before'] = '<h2>' . get_the_ID() . '</h2> - ' . $params['before'];
    	return $params;
    },10);

    Then, add this in Appearance > Customize > Additional CSS:

    header.entry-header h2 {
        display: inline;
    }
    #2364757
    priyankeshu

    thanks! man! really appreciate this! i love generatepress support!

    last question,
    can you suggest me through any tutorial where i can learn more about about this? i mean for example, if i want to learn how to add specific categories tags etc. in similar method.

    #2364764
    Fernando
    Customer Support

    You’re welcome!

    Do you mean all categories/tags of a specific post, or just a specific category in general?

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.