• Resolved mysticalcode

    (@mysticalcode)


    Hello,

    RE: https://www.advancedcustomfields.com/resources/including-acf-within-a-plugin-or-theme/

    Can I do the same for ACF Extended as well? What directory and/or URL paths should I be adjusting?

    Code guidelines from ACF website:

    // Define path and URL to the ACF plugin.
    define( 'MY_ACF_PATH', get_stylesheet_directory() . '/includes/acf/' );
    define( 'MY_ACF_URL', get_stylesheet_directory_uri() . '/includes/acf/' );
    
    // Include the ACF plugin.
    include_once( MY_ACF_PATH . 'acf.php' );
    
    // Customize the url setting to fix incorrect asset URLs.
    add_filter('acf/settings/url', 'my_acf_settings_url');
    function my_acf_settings_url( $url ) {
        return MY_ACF_URL;
    }
    
    // (Optional) Hide the ACF admin menu item.
    add_filter('acf/settings/show_admin', 'my_acf_settings_show_admin');
    function my_acf_settings_show_admin( $show_admin ) {
        return false;
    }

    Thank you in advance.

    Cheers,
    M

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback! Absolutely! You can use the exact same method for ACF Extended which also has its own acfe/settings/url setting.

    Usage example:

    // Define Path
    define('MY_ACFE_PATH', get_stylesheet_directory() . '/includes/acf-extended/');
    define('MY_ACFE_URL', get_stylesheet_directory_uri() . '/includes/acf-extended/');
    
    // Include ACFE
    include_once(MY_ACFE_PATH . 'acf-extended.php');
    
    // Customize URL setting
    add_filter('acfe/settings/url', 'my_acfe_settings_url');
    function my_acfe_settings_url($url){
        return MY_ACFE_URL;
    }
    

    Have a nice day!

    Regards.

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello @crazytraders877zx,

    What do you mean by “showing funny”? Please see my answer above, and make sure that you correctly set the acfe/settings/url setting.

    Edit: All your CSS/JS files trigger 404 errors since they try to be loaded from crazytraders.nets/wordpress/, but this folder doesn’t exists. This is why there is no style on your site. See screenshot: https://i.imgur.com/MHS0jKn.jpg

    This problem isn’t related to ACF Extended tho. You should check your WP Options “Site URL” & “WordPress URL” settings and remove the /wordpress/ from the URL.

    Regards.

    Thread Starter mysticalcode

    (@mysticalcode)

    Hi @hwk-fr,

    This is helpful, mate. I’ll give it a go.

    Je te remercie.

    Cheers,
    M

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    You’re welcome! I’ll add it to the documentation later.

    Bonne journée ??

    Regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Including ACF & ACFE within a plugin?’ is closed to new replies.