Notifications
Clear all

wpForo 1.x.x [Solved] How to display post ID number

6 Posts
2 Users
1 Reactions
1,990 Views
JorgeW
Posts: 107
Topic starter
(@jorgew)
Estimable Member
Joined: 6 years ago

Hi @robert,

I would like to display (near by the link icon maybe) the post ID number of each and every post in my forums (the number that is included in the URL within the link icon).

Is this possible??

It would allow me to make explicit the Post Number that identifies each post in the forums. If I'm correct, this number is incremental and unique. ID numbers from deleted posts never get used again. So this number becomes a perfect reference ID for any post (topic, reply, comment, question, answer) and we could use it precisely as a dependable, quick, and short reference to a post, without the need to write nothing else, for example in an email: "Please do remember that we discussed this issue in post #123 and we decided bla bla bla…"

At the same time, it could become "searchable" (be part of the search dialog):

Go To Post #:  [  123   ]

Making it easier, quickier and more precise to get "right to the substance" of any forum.

Thanks.

-----

PS: After posting this topic, I can check via the link icon that it is the post #25519

This is the number I'm interested to be able to display.

5 Replies
Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

Hi @jorgew,

I'm sorry but there is no an easy way to do this. You should use template file customization instruction to customize the post.php file of the forum layout you use.Here is the documentation: https://wpforo.com/docs/root/forum-themes/theme-customization/

You should insert PHP code to display post ID:

<?php echo intval($post['postid']); ?>

 

1 Reply
JorgeW
(@jorgew)
Joined: 6 years ago

Estimable Member
Posts: 107

Thanks for you reply @robert, I will try and come back with news (good news I hope)

JorgeW
Posts: 107
Topic starter
(@jorgew)
Estimable Member
Joined: 6 years ago

Hi @robert,

It works just as I wanted, take a look.

There is only one problem, it seems that 'postid' is not the variable name for comment ID in Q+A layout (classic theme). It will, for example, display "0" when the URL indicates that it is post 287 (seen at the bottom left)

Can you help me with this issue?

Robert
Posts: 10591
Admin
(@robert)
Support Team
Joined: 9 years ago

Comments are located in classic/layouts/3/comment.php file, you should use this variable:

<?php echo intval($comment['postid']) ?>
JorgeW
Posts: 107
Topic starter
(@jorgew)
Estimable Member
Joined: 6 years ago

Thanks, fixed it!

One last thing, could it be made searchable?

Something like this?