design article title and add author virtual page
This commit is contained in:
parent
6fe73efbcf
commit
2114fbbb8e
12 changed files with 129 additions and 25 deletions
37
site/plugins/helpers/index.php
Normal file
37
site/plugins/helpers/index.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
function setTitleFontSizeClass($title, $level = 'h1')
|
||||
{
|
||||
$length = strlen($title);
|
||||
|
||||
if ($level === 'h1') {
|
||||
switch (true) {
|
||||
case ($length < 35):
|
||||
return 'fs-xxl';
|
||||
break;
|
||||
|
||||
case ($length < 70):
|
||||
return 'fs-xl';
|
||||
break;
|
||||
|
||||
default:
|
||||
return 'fs-l';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getAuthorBySlug($slug)
|
||||
{
|
||||
$kirby = kirby();
|
||||
$author = '';
|
||||
foreach ($kirby->users() as $user) {
|
||||
|
||||
if (Str::slug($user->name()) === $slug) {
|
||||
|
||||
$author = $user;
|
||||
}
|
||||
}
|
||||
|
||||
return $author;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue