简体   繁体   中英

Insert ACF custom field into comments WordPress

I created a shortcode like this:

function lijst_reacties(){
comments_template(); 
}
add_shortcode('reacties','lijst_reacties');

But it shows everything I need except that I need to add a custom field after the author name. The custom field is called beroepsfunctie . How can I insert this one after the author name?

I would recommend creating your own comments template. The template should be called comments.php and exist in the root of your theme directory. This way when you call comments_template(); it will pull from your custom template.

If you want to have multiple comments templates you can create another comments template and call the function as such comments_template('comments-custom.php');

Here is the link to the Comment Template section in the theme developers handbook https://developer.wordpress.org/themes/template-files-section/partial-and-miscellaneous-template-files/comment-template/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM