Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    I am not sure I am following what you are doing. Can you post some example code (use a service like pastebin or something).

    Thanks,

    Matt

    Thread Starter CesarDenis

    (@cesardenis)

    I have included in the function.php the following code:

    function register_fields() {
            include_once( get_stylesheet_directory() . '/inc/add-ons/font-awesome/acf-font-awesome-v5.php');
    }
    add_action('acf/include_fields', 'register_fields');

    to include your plugin.

    When I select an icon in my field, I found that was not load the icons, was appearing square in place.

    So I checked the page code and saw the following line:

    <link rel='stylesheet' id='acf-input-font-awesome-input-css' href='https://developer.adesign.com.br/orangeone/wordpress/wp-content/plugins/Applications/MAMP/htdocs/orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome/css/input.css?ver=1.5' type='text/css' media='all' />

    I hope it helps ??
    Cesar

    Plugin Author Matt Keys

    (@mattkeys)

    Which version of ACF are you using?

    Thread Starter CesarDenis

    (@cesardenis)

    ACF PRO 5.2.1

    Plugin Author Matt Keys

    (@mattkeys)

    Interesting problem, it looks like it comes down the the plugin_dir_url() function used to find the path to the CSS/JS assets. Notice how the asset URL includes the PHP path.

    I see some conversation about it on stack exchange here: https://wordpress.stackexchange.com/questions/41868/plugin-dir-url-adds-path-to-url

    Presumably this problem is effecting all 5.x add-ons that include their own CSS/JS, because this function comes right out of the ACF add on template I used to create this plugin: https://github.com/elliotcondon/acf-field-type-template/blob/master/acf-FIELD_NAME-v5.php

    I am not sure what the fix is yet, but I will take a peak at the v4 methods of finding this asset path because they appear different than v5.

    Plugin Author Matt Keys

    (@mattkeys)

    Here is an experimental version of the v5 file which uses the old ACF 4.x method of finding asset paths:

    https://pastebin.com/9kaBHEGi

    Let me know how it works for you, seems to fix the problem locally for me.

    Thread Starter CesarDenis

    (@cesardenis)

    It worked ?? see the log:

    Array
    (
        [path] => /Applications/MAMP/htdocs/orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome
        [dir] => https://developer.adesign.com.br/orangeone/wordpress/wp-content/themes/orangeone/inc/add-ons/font-awesome/
        [version] => 1.5
    )

    Thanks,
    Cesar

    Plugin Author Matt Keys

    (@mattkeys)

    Cool thanks for testing.

    I will test this a bit more and roll it into an update. I will report the issue to ACF too so Elliot is aware that this problem is out there.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Load plugin in my theme’ is closed to new replies.