Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
2 posts Page 1 of 1
Hi all.

We create a new clonable template and visit it as super-admin very often.
This trick is to enjoy some automation with autocreated default pages, to make a nice-looking name and auto-un-publish like this:
BEFORE:
download (2).jpg
BEFORE
download (2).jpg (9.26 KiB) Viewed 650 times

AFTER:
download (1).jpg
AFTER
download (1).jpg (5.96 KiB) Viewed 650 times


Implementation:
Find in /couch/page.php, line 650:
Code: Select all
$title = 'Default page for '.$DB->sanitize( $this->tpl_name ).' * PLEASE CHANGE THIS TITLE *'; // . $this->tpl_name;
$name = $FUNCS->get_clean_url( $title );

change to:
Code: Select all
$title = 'default page'; // paste here any new title you like
$name = 'Default page for '.$DB->sanitize( $this->tpl_name ).' * PLEASE CHANGE THIS TITLE *'; // name will be left untouched, I don't care about it.
$name = $FUNCS->get_clean_url( $name );

and to unpublish, find in the same page.php Line 1289
Code: Select all
'publish_date'=>( $this->tpl_gallery && $is_master ) ? '0000-00-00 00:00:00' : $cur_time,
'is_master'=>$is_master

change to
Code: Select all
'publish_date'=>( $this->tpl_gallery && $is_master ) ? '0000-00-00 00:00:00' : $cur_time,
'publish_date'=>( $is_master ) ? '0000-00-00 00:00:00' : $cur_time,
'is_master'=>$is_master


I love it!
After a while using it: This tip has a drawback as it puts newly-registered non-clonable templates to unpublished state too, which needs to be amended through Advanced Settings of the template.

A solution is coming on the way.
2 posts Page 1 of 1

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests