functions.php: add shortcode to set title on distromatic search pages

This commit is contained in:
Silvan Calarco 2020-06-27 13:14:44 +02:00
parent 8ab60cce44
commit 8d3e4a72a4

View File

@ -56,6 +56,32 @@ function add_search_box($items, $args) {
} }
add_filter('wp_nav_menu_items','add_search_box', 10, 2); add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function set_title($title) {
$urlargspos = strpos($_SERVER[REQUEST_URI], '?');
if ($urlargspos > 0) {
$urlargs = substr($_SERVER[REQUEST_URI], $urlargspos + 1);
parse_str($urlargs, $args);
$newtitle = $title;
if ($args['arch']) {
$newtitle = $args['arch'] . " - " . $newtitle;
}
if ($args['tag']) {
$newtitle = $args['tag'] . " - " . $newtitle;
}
if ($args['pkg']) {
if ($args['pkg'] == '_index')
$newtitle = 'Index - ' . $newtitle;
else {
$e = explode('.', $args['pkg']);
$newtitle = $e[0] . " - " . $e[1] . " - " . $newtitle;
}
}
return $newtitle;
}
return $title;
}
add_filter('wp_title','set_title');
// openmamba downloads pages // openmamba downloads pages
function openmamba_download_link($milestone, $medium, $currarch, $ext, $mlword, $lang) { function openmamba_download_link($milestone, $medium, $currarch, $ext, $mlword, $lang) {
$latest_file = "/var/ftp/pub/openmamba/media/".$milestone."/".$medium."/".$lang."/latest.inc.php"; $latest_file = "/var/ftp/pub/openmamba/media/".$milestone."/".$medium."/".$lang."/latest.inc.php";