Forum Replies Created
Viewing 1 post (of 1 total)
-
AuthorPosts
-
Johannes Tiner
ParticipantQuick respond, me like 🙂
I found your YT video when googeling after i found out that ACF pro could add fields in widgets wich i didn’t know 😛
When using it as a plugin it works except for it is outputting a string’URL_TO_WIDGET-FILE.PHP’.. not sure im doing something wrong, don’t think i am tho.
Anyway, still can’t get this to work haha, i feel so dumb 😛
if i understand this correctly you are creating your widget in this code instead of doing it in the UI :
add_filter('acfw_include_widgets', 'add_include_widgets'); function add_include_widgets(){ $acfw_widgets = array( array( 'title' => 'Test Widget 1', 'description' => 'A widget test from functions.php', 'slug' => 'test-widget', 'id' => 'Test_Widget', ), array( 'title' => 'Test Widget 2', 'description' => 'A second widget test from functions.php', 'slug' => 'test-widget-2', 'id' => 'Test_Widget2', ), ); return $acfw_widgets; }
do i need to change anything else?
And then i have this code to guide wp to the correct folder:
include_once( get_stylesheet_directory() . '/acfw/acf-widgets.php' ); // Enable include mode add_filter('acfw_include', '__return_true'); // Filter for ACFW include directory. Reletive to the theme root. Necessary for include mode. add_filter('acfw_dir', 'acfw_directory'); function acfw_directory( $dir ){ // default value is /acf-widgets/ return '/acfw/'; }
-
AuthorPosts
Viewing 1 post (of 1 total)