Hi, I have a parent post type called a "fair" and each fair has many children posts called "booths". I am trying get the number of the child (number of the first booth created would be 1, the number of the second booth created would be 2, etc). The reason I want this I want to display this number in the booth post content template. This means that the booth that was created first would be displayed as "booth 1" and the booth that was created 20th would be "booth 20". However, even though it seems that Toolset seems to store the list of booths for a career fair and I can display this list via views, I do not know how to get the number of the booth.
Is there any documentation that you are following?
I found this topic here: https://toolset.com/forums/topic/auto-incrementing-id/
That seems very similar. This user seems to be trying to get a custom field value and automatically increment it. It seems like I could have a custom field name "booth number" and automatically increment it for each booth to assign them a number, but it seems like this type of number might already be available in Toolset. Also, I am not familiar with editing my theme/php file so I am not sure how to do it in this approach.
What is the link to your site? hidden link
This is a link to test career fair with different employer "booths".
Please note that the above shortcode will output the loop index, not any other number, if you want to display a stored number, I think that might be the better approach to number your booths. You should create a "booth number" field and as you said, when you save your post, you should automatically increment the number to it but if the above option works for you then you can go with that.
This is is very helpful as this allows me to to display the booth number in the view.
However, I would also like to be able to display the booth number within the booth post, which I am not sure if it is possible with this approach. I will need that number for a variety of things, such as directing users to a url as well (mysite/booth1.com). Is there a way to display this within the actual post as well?
As I shared the information regarding the [wpv-loop-index] shortcode that the number will be generated by the shortcode [wpv-loop-index] and it will work within the view only. In this case the Booth number is not attached to post but its exclusively generated by the View.
=> https://toolset.com/documentation/user-guides/views/views-shortcodes/#wpv-loop-index
I suggest the better approach would be, you should add a custom field to your booth post that holds the booth id.