Hi,
I have a job site where I use no. of vacancies (RFG) as custom fields. Can you help me to create a shortcode to sum up the values of the field mentioned?
Thank you.
What is the parent post type which the RFG belongs to?
What is the field within the RFG that contains the number you want to create a total for?
Where will the shortcode be inserted? Into a template for the parent post, and it will add up the values from the specific field in all of the child RFGs?
Thanks for your reply.
Let me explain things elaborately.
I am using job posts as custom posts where I use No. of Vacancies (RFG) against each vacant position. One job post has single custom fields as well as RFGs (to depict each job position). You can have a look at this URL to understand it hidden link
See the Screenshot_1
-What is the parent post type which the RFG belongs to?
jobs
-What is the field within the RFG that contains the number you want to create a total for?
no-of-vacancies
-Where will the shortcode be inserted? Into a template for the parent post, and it will add up the values from the specific field in all of the child RFGs?
I want to show it in Jobs Archive against the specific post.
Hope I can make you understand. If anything else required please let me know. Thanks
I forgot to ask what the slug of the RFG was, but I've prepared an example shortcode where you can edit the parent CPT slug, the RFG slug, and the custom field slug at the top.
This really should be work that's done by a developer rather than support, but here's an example you can edit and use for your needs. It registers a custom shortcode "sum-rfg".
Hi,
I have tried the code suggested by you but seems to be not working properly. You can see the front-end view in screenshot_1.
I have added the shortcode and changed the RFG slug as well as the field name slug (see the screenshot_2)
If you wish I can share the login credentials for further check. Thanks.
The fact that the shortcode is being printed as [sum-rfg] rather than being replaced with... something... means that the code to register the shortcode is not being triggered.
So I would double-check that the code snippet you added is activated.