Skip to content

Commit 4682917

Browse files
committed
Added a shortcode option to modify displayed titles for links.
1 parent 50c142b commit 4682917

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

SimplePagesPlugin.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,16 @@ public static function shortcodeSimplePages($args, $view)
460460
break;
461461

462462
case 'link':
463+
// Check if different titles should be used, generally shorter.
464+
// They should be as many as slugs, in the same order. If empty,
465+
// the original title is used. They must be separated by a "|".
466+
$titles = isset($args['titles']) ? explode('|', $args['titles']) : array();
467+
463468
$html .= $list ? '<ul class="simple-page-titles">' : '';
464469
foreach ($simplePages as $simplePage) {
470+
$title = array_shift($titles) ?: $simplePage->title;
465471
$html .= $list ? '<li class="simple-page-title">' : '<span class="simple-page-title">';
466-
$html .= link_to($simplePage, null, html_escape($simplePage->title));
472+
$html .= link_to($simplePage, null, html_escape($title));
467473
$html .= $list ? '</li>' : '</span>';
468474
}
469475
$html .= $list ? '</ul>' : '';

0 commit comments

Comments
 (0)