最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How Do I Use a ACF Custom Field To Add A Slider ID?

programmeradmin2浏览0评论
soliloquy( the_field( 'slider' ) );

This is my code to add the ID for a slider from a ACF number field to a slider function call however it outputs the ID and doesn't execute the soliloquy function.

I think it might have something to do with the single qoutes.

Not sure how to wrap the slider ID in single qoutes

soliloquy( the_field( 'slider' ) );

This is my code to add the ID for a slider from a ACF number field to a slider function call however it outputs the ID and doesn't execute the soliloquy function.

I think it might have something to do with the single qoutes.

Not sure how to wrap the slider ID in single qoutes

Share Improve this question asked Oct 8, 2020 at 6:08 Brad DaltonBrad Dalton 6,9652 gold badges36 silver badges47 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

You need to use get_field() function instead. It will RETURN the value instead of printing. So, your code will be:

soliloquy( get_field( 'slider' ) );

This works but i prefer to use the ACF specific custom field function

soliloquy( get_post_meta( get_the_ID(), 'slider', true ) );
发布评论

评论列表(0)

  1. 暂无评论