Can't get custom fields to work

Post Reply
User avatar
cobber
Master Bludit
Posts: 78
Joined: Sun Feb 28, 2016 10:15 am
Location: Scotland
Has thanked: 21 times
Been thanked: 5 times

Morning, I have been following the documentation for Bludit and reading about using custom fields.


I added the following to the custom fields text area:

{
"subtitle": {
"type": "string",
"placeholder": "Subtitle for the page"
}
}

I have tried adding the JSPON inside the array [] and also without the array too, just in case I misunderstood.

I have followed the exact examples but am getting no output using the following:

echo "The subtitle of the page is " . $page->custom('subtitle');

Any ideas please?


Thank you
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

cobber wrote: Mon Mar 29, 2021 10:33 am I have followed the exact examples but am getting no output using the following:

echo "The subtitle of the page is " . $page->custom('subtitle');
It must be:

Code: Select all

<?php
   echo "The subtitle of the page is " . $page->custom('subtitle');
?>
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
cobber
Master Bludit
Posts: 78
Joined: Sun Feb 28, 2016 10:15 am
Location: Scotland
Has thanked: 21 times
Been thanked: 5 times

Hi, thanks for the reply.

I have the code inside the required PHP tags. I didn't include them purely because I assumed most people would be aware of PHP.

I've tried the following:
<?php
echo "The title of the page is " . $page->title();
echo "The subtitle of the page is " . $page->custom('subtitle');
?>

I get an output for $page->title()

but not $page->custom('subtitle');

I'll keep messing around with it.
It appears to be a bit intermittent as it now works after I deleted several test pages.

Thanks
Post Reply