Show a page's description on the page

Permalink
Hi All,

How would I show the description of a page (from Properties) on the page?

I only want it on one or two pages so I don't want to edit my theme, I would like to insert the description using a block, such as the Simple PHP block.

NB - v5.6

Many thanks,
Mike

designserve
 
A3020 replied on at Permalink Best Answer Reply
A3020
<?php
$page = Page::getCurrentPage();
echo $page->getCollectionDescription();
designserve replied on at Permalink Reply
designserve
Thank you so much!

I have implemented most pages using JTFs Magic Heading. So, I'm updating the description by editing directly on the page and then the description is used by Page List on other pages.

However, your code lets me do other things in a less complicated way. I was almost there but couldn't quite work it out. I'm very grateful.
JohntheFish replied on at Permalink Reply
JohntheFish
If you are reflecting back a description gathered with Magic Heading, you should put it inside a class-marked set of tags and exclude that from Magic Heading's selection.
designserve replied on at Permalink Reply
designserve
Thanks for the pointer regarding the class John. I'm implementing what I originally wanted to do using Magic Heading (works perfectly as always and took me a while to figure out, you know what I'm like!).

A3020's code useful for other pages.

I would love to be able to optionally pull (and style) the description onto the page using Magic Heading (ie, use it in the opposite direction to which it was intended, only for the description) let me know if you ever get around to considering that but I understand that it probably doesn't fit with your master plan. I don't want to implement Magic Data on this site yet, the site is an experiment and I have several new sites in the works I have to take them step by small step so that I can cope.