Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Danny van Kooten

    (@dvankooten)

    Hi there,

    You can use the Advanced Custom Fields plugin to add a custom field to the Widget Blocks. To show this post on (the public section / frontend) of your website you will need some additional code though.

    You can use the ww_content filter hook to add the value of this custom field to the widget content. Are you familiar with PHP and the way WordPress filters work? Your code would look something like this.

    function my_widget_block_content($content, $id) {
    	$field = get_field('my_custom_field', $id);
    
    	$content .= "\nField value: {$field}";
    	return $content;
    }
    
    add_filter('ww_content', 'my_widget_block_content', 10, 2);

    Hope that helps!

    Thread Starter TA003

    (@ta003)

    Great! Just what I needed!
    This saved me a lot of time!

    Thanks!

    Plugin Author Danny van Kooten

    (@dvankooten)

    Great, glad I could help!

    PS. I would really appreciate it if you could leave a review on the plugin, once you have a quick minute.

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Compatible with 'advanced custom fields'?’ is closed to new replies.