Support

Account

Home Forums ACF PRO ACF PRO inclusion: problem with files path

Solved

ACF PRO inclusion: problem with files path

  • Hi, I have a problem with Advanced Custom Fileds PRO inclusion in my theme.

    I added this code to functions.php

    require_once(get_template_directory() . '/acf/acf.php');
    
    function acf_path($path) {
    	$path = get_template_directory() . '/acf/';
    	return $path;
    }
    add_filter('acf/settings/path', 'acf_path');
    
    function acf_dir($dir) {
    	$dir = get_template_directory() . '/acf/';
    	return $dir;
    }
    add_filter('acf/settings/dir', 'acf_dir');

    Now I have the plugin menĂ¹ item in the admin but it doesn’t work.

    I looked in Firebug console and there are some errors about files path.

    For example:

    “NetworkError: 403 Forbidden – http://localhost/wp_rbE:wampwwwwp_robertobaggiowidewp-contentthemesrobertobaggiowide//acf/css/global.css?ver=5.0.7”

    I proved to substitute

    get_template_directory

    with

    get_stylesheet_directory

    but this doesn’t solve the problem.

    Can you help me, please?

  • Hey, just tried to install it myself and did it like this, which seems to work:

    
    function ACFProSetDir($dir) {
       $dir = get_template_directory_uri() . '/plugins/acf/';
       return $dir;
    }
    
    add_filter('acf/settings/dir', 'ACFProSetDir');
    

    In short: I only used acf/settings/dir and instead of setting a dir, I’ve set a path? Kinda weird, but seems to work.

  • Hi bdekort, I tried your solution and it works.

    Perhaps my initial solution (the one that is in the documentation) works good when the site is online while it doesn’t work in local!?

    At any rate, thank’s for your help,

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘ACF PRO inclusion: problem with files path’ is closed to new replies.