Jump to content

Display Custom Fields in Theme


JanPavelka
 Share

Recommended Posts

Hi and welcome ... You can add your own field in a very simple way ...

See also here https://processwire.com/api/variables/page/

You have to go to the template that the page uses and add a few lines of php code as below ...

<?php echo page()->custom_field?>
<?php echo $page->custom_field?>
<?php echo page('custom_field')?>

See this short video in which I used the regular UIKIT 3 profile which is in the Processwire DEV version

You can display this field in the _main.php file in the same way, or if for example, you create an option page, you can use this way in which the field will be visible on all pages  https://processwire.com/api/variables/pages/ ...

		<h1>Home Page Field ( / ) <?= pages('/')->custom_field ?></h1>
		<h1>Home Page Field ( / ) <?= pages()->get('/')->custom_field ?></h1>

		<h1>About Page Field ( /about/ ) <?= pages('/about/')->headline ?></h1>
		<h1>About Page Field ( /about/ ) <?= pages()->get('/about/')->headline ?></h1>

This old tutorial is also good to starting learn Processwire :

https://processwire.com/docs/tutorials/hello-worlds/

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...