Support

Account

Home Forums General Issues How to calculate the values

Solving

How to calculate the values

  • Hello,
    I am here to ask that I have a site of Career. So I have a custom field of Vacancies and this field is a text field. We add here numeric digits. Is it possible that we can gather all the vacancies? Let say.. we have posted 89 jobs in 7 days and we added the vacancies as well. So we want to show that 750 Vacancies in the Last 7 Days or 30 Days.

  • Yes, you can achieve this using the WordPress WP_Query and passing advanced custom fields to it with a meta query. Instructions on how to do this can be found here: https://www.advancedcustomfields.com/resources/query-posts-custom-fields

  • Thank you for the reply, but actually, I don’t want to show the loop, just want to show in Text format only.

  • You will need to to a query on the posts to get all of the posts as mentioned by @speakincode. Then you will need to loop over these posts and add up the totals. There isn’t a way in WP to get and calculate this without doing a query and a loop.

    The only way you’ll be able to do the “last X days” part is if you also have a date field that is edited to indicate when the vacancies where added. This will complicated the admin and the query because you’re going to need some way to separate the vacancies added yesterday from the vacancies added 2 weeks ago.

  • Yes, you can achieve this using the WordPress WP_Query and passing advanced custom fields to it with a meta query. Instructions on how to do this can be found here: https://www.advancedcustomfields.com/resources/query-posts-custom-fields

    Brilliant, thanks for sharing this info. This is all very interesting 🙂

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘How to calculate the values’ is closed to new replies.