Jump to content

Date field as Page Label


Falk
 Share

Recommended Posts

Hi!

I have lots of blogposts in my pagetree and I want the pagelabel to include the value of the post’s datefield (only the year).

Adding date | title in the template settings results in something like…
1536012000 | my blogpost title

Is it possible to convert the timestamp to a readable date?

 

Link to comment
Share on other sites

I have the following In my template's settings under Advanced > List of fields to display in the admin Page List

{event_start_datetime} - {title}

I believe it will show the date as the field is configured under the field's date and time output format code in the field's settings > Details.

In my case the page tree shows:

May 2, 2018 7:30 pm - Name of my event

Edited by gmclelland
Added the word "code"
Link to comment
Share on other sites

37 minutes ago, tpr said:

I usually don't set dates output formatting because it's easier to handle in templates, and this way they are displayed as timestamps in the page list.

If that's your concern you could always use $page->getUnformatted('datefield') in your templates and use the outputformatting just for the backend formatting.

  • Like 3
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...