Accessing carbon_get_post_meta value inside of a namespace

573 Views Asked by At

How can I access a Carbon Fields value using the function carbon_get_post_meta from within a namespace?

If I do:

if ( function_exists( 'carbon_get_post_meta' ) ):
    echo 'true';
else:
    echo 'false';
endif;

Then I get false, but if I check for the function inside of page.php with the same code, then it returns true.

I have tried checking for '\carbon_get_post_meta' as well but the result is the same.

Please can someone point me in the right direction.

EDIT:

This is the framework I'm using https://github.com/seothemes/genesis-starter-theme inside of lib I set up carbon fields inside of the plugins directory, and called it inside init.php, I know this is working because I have set up some post meta using carbon fields, but when I try to access the data from within lib/plugins with the namespace namespace SeoThemes\GenesisStarterTheme\Plugins it says that the function is undefined

Hope this helps?

1

There are 1 best solutions below

2
On

As far as I know it was supposed to be working, try this please

if ( \function_exists( 'carbon_get_post_meta' ) ):
    echo 'true';
else:
    echo 'false';
endif;