Support

Account

Home Forums General Issues Get category title and custom field from a post

Helping

Get category title and custom field from a post

  • Hello all,

    I am using Avada theme, and ACF. I need to get a specific category’s title, and custom field ($custom_field) from a post. I know this is pretty simple, and I’ve tried a few things but not quite there.

    For PHP code, I am only using functions.php, I am not modifying other templates due to project requirements unrelated to this specific question.

    Sometimes in Avada, I can call ACF by field name in their Avada Live / Fusion Builder GUI – but those instances do not allow me to specify a post_id or any other parameters. But I can call a shortcode in basic text fields of course.

    So, when using ACF in Options page, I would do [acf field="custom_field" post_id="option"]. If i want to do this same, but my custom_field is on a category edit page, how do i call the location parameter?

    The category I am trying this with, on hover in categories edit page, i see tag_ID=154, so i try shortcode of [acf field="offers_code_cats_L2" tag_id="154"] and also tried tag_ID and post_id and none of which work.

    What am i missing?

  • TYPO:

    When i said custom_field, i was referring to offers_code_cats_L2 – so they are interchangeable and one and the same.

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

You must be logged in to reply to this topic.