Non-Object Error When Displaying Text That Has Been Configured in Dashboard
Permalink
Ok, I am working on a theme, and am encountering a fatal error.
I have a settings single page in the dashboard for a theme with 2 text fields that are intended to show that text on a theme page.
They both save fine in the back-end. However, the error happens in the front-end.
The first text field displays fine (it's a slogan). The code I used for it as follows in the page type (home.php):
Then, I have another text (as configured / saved in the back-end) that is causing the error. I used the same type of code as above, which is in elements/footer.php:
But, instead it gives me the error:
I'm perplexed.
I have a settings single page in the dashboard for a theme with 2 text fields that are intended to show that text on a theme page.
They both save fine in the back-end. However, the error happens in the front-end.
The first text field displays fine (it's a slogan). The code I used for it as follows in the page type (home.php):
<h3 class="slogan"><?php echo $pkg->config('slogan');?></h3>
Then, I have another text (as configured / saved in the back-end) that is causing the error. I used the same type of code as above, which is in elements/footer.php:
<p class="fabout"><?php echo $pkg->config('fabout');?></p>
But, instead it gives me the error:
Fatal error: Call to a member function config() on a non-object in /home/gcloca5/public_html/c5/packages/flexcrete/themes/flexcrete/elements/footer.php on line 3
I'm perplexed.
However, is there another way that I can make it so that something like this is added to /elements/footer.php? I assume it is a different syntax than what I had above?
Any help is appreciated.