Loading functions.php +40 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,46 @@ function fscoli_disable_users_sitemap($provider, $provider_name) { // To re-enable /wp-sitemap-users-1.xml and /en/wp-sitemap-users-1.xml, remove the line below add_filter('wp_sitemaps_add_provider', 'fscoli_disable_users_sitemap', accepted_args: 2); function fscoli_find_latest_post($search_query) { $posts = get_posts([ "s" => $search_query, "search_columns" => ["post_title"], "post_type" => "post", "order" => "desc", "orderby" => "date" ]); return $posts[0]; } function fscoli_redirect_freshers_days() { $uri = $_SERVER["REQUEST_URI"]; if($uri == "/erstitage/aktuell" || $uri == "/erstitag/aktuell") { $post = fscoli_find_latest_post("Ersti"); wp_redirect(get_page_link($post)); exit; } else if($uri == "/en/freshers-days/latest") { $post = fscoli_find_latest_post("Fresher"); wp_redirect(get_page_link($post)); exit; } } add_action("template_redirect", "fscoli_redirect_freshers_days"); function fscoli_latest_freshers_days_shortcode() { if(str_starts_with(get_bloginfo('language'), 'de')) { $post = fscoli_find_latest_post("Ersti"); return '<a href="/erstitage/aktuell">' . get_the_title($post) . "</a>"; } else { $post = fscoli_find_latest_post("Fresher"); return '<a href="/en/freshers-days/latest">' . get_the_title($post) . "</a>"; } } add_shortcode("fscoli_latest_freshers_days", 'fscoli_latest_freshers_days_shortcode'); wp_enqueue_script('fscoli-utils', get_template_directory_uri() . '/js/utils.js'); wp_enqueue_script('fscoli-pills', get_template_directory_uri() . '/js/pills.js'); ?> style.css +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Author: personads :: Maximilian Müller-Eberstein (ursprüngliche Version und Design); Jakob Moser * Author URI: https://personads.me/ * * Version: 2.17.6 * Version: 2.18.0 * Requires PHP: 8.0 * * License: GNU General Public License v3.0 Loading Loading
functions.php +40 −0 Original line number Diff line number Diff line Loading @@ -251,6 +251,46 @@ function fscoli_disable_users_sitemap($provider, $provider_name) { // To re-enable /wp-sitemap-users-1.xml and /en/wp-sitemap-users-1.xml, remove the line below add_filter('wp_sitemaps_add_provider', 'fscoli_disable_users_sitemap', accepted_args: 2); function fscoli_find_latest_post($search_query) { $posts = get_posts([ "s" => $search_query, "search_columns" => ["post_title"], "post_type" => "post", "order" => "desc", "orderby" => "date" ]); return $posts[0]; } function fscoli_redirect_freshers_days() { $uri = $_SERVER["REQUEST_URI"]; if($uri == "/erstitage/aktuell" || $uri == "/erstitag/aktuell") { $post = fscoli_find_latest_post("Ersti"); wp_redirect(get_page_link($post)); exit; } else if($uri == "/en/freshers-days/latest") { $post = fscoli_find_latest_post("Fresher"); wp_redirect(get_page_link($post)); exit; } } add_action("template_redirect", "fscoli_redirect_freshers_days"); function fscoli_latest_freshers_days_shortcode() { if(str_starts_with(get_bloginfo('language'), 'de')) { $post = fscoli_find_latest_post("Ersti"); return '<a href="/erstitage/aktuell">' . get_the_title($post) . "</a>"; } else { $post = fscoli_find_latest_post("Fresher"); return '<a href="/en/freshers-days/latest">' . get_the_title($post) . "</a>"; } } add_shortcode("fscoli_latest_freshers_days", 'fscoli_latest_freshers_days_shortcode'); wp_enqueue_script('fscoli-utils', get_template_directory_uri() . '/js/utils.js'); wp_enqueue_script('fscoli-pills', get_template_directory_uri() . '/js/pills.js'); ?>
style.css +1 −1 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ * Author: personads :: Maximilian Müller-Eberstein (ursprüngliche Version und Design); Jakob Moser * Author URI: https://personads.me/ * * Version: 2.17.6 * Version: 2.18.0 * Requires PHP: 8.0 * * License: GNU General Public License v3.0 Loading