55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
// Theme setup.
|
|
function super_simple_theme_setup() {
|
|
add_theme_support("title-tag");
|
|
}
|
|
add_action("after_setup_theme", "super_simple_theme_setup");
|
|
|
|
|
|
// Register the theme's navigation menu.
|
|
function register_my_menu() {
|
|
register_nav_menu("header-menu", __("Header Menu", "super-simple-wp-theme"));
|
|
}
|
|
add_action("init", "register_my_menu");
|
|
|
|
|
|
// Redirect guests to the login page when they visit the forum.
|
|
function redirect_to_login_if_not_logged_in() {
|
|
if (function_exists("is_bbpress") && is_bbpress() && !is_user_logged_in()) {
|
|
wp_redirect(wp_login_url(get_permalink()));
|
|
exit;
|
|
}
|
|
}
|
|
add_action("template_redirect", "redirect_to_login_if_not_logged_in");
|
|
|
|
|
|
// Strip the "Privat: " prefix from private post titles (front end only).
|
|
function remove_private_title_prefix($title) {
|
|
if (is_admin()) {
|
|
return $title;
|
|
}
|
|
return str_replace("Privat: ", "", $title);
|
|
}
|
|
add_filter("the_title", "remove_private_title_prefix");
|
|
|
|
|
|
// Output a logout link for logged-in users.
|
|
function add_logout_button() {
|
|
if (is_user_logged_in()) {
|
|
echo '<a href="' . esc_url(wp_logout_url(home_url())) . '">Logg ut</a>';
|
|
}
|
|
}
|
|
|
|
|
|
// Override the default WordPress sender address.
|
|
function new_mail_from($old) {
|
|
return "info@taubaneforeningen.no";
|
|
}
|
|
add_filter("wp_mail_from", "new_mail_from");
|
|
|
|
function new_mail_from_name($old) {
|
|
return "Norske Tau- og Kabelbaners Forening";
|
|
}
|
|
add_filter("wp_mail_from_name", "new_mail_from_name");
|