54 lines
1.5 KiB
PHP
54 lines
1.5 KiB
PHP
<?php
|
|
function register_my_menu() {
|
|
register_nav_menu("header-menu", __( "Header Menu" ));
|
|
}
|
|
add_action( "init", "register_my_menu" );
|
|
|
|
|
|
// Vidaresend til innlogging viss ein ikkje er innlogga på forumet
|
|
function redirect_to_login_if_not_logged_in() {
|
|
if (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');
|
|
|
|
|
|
// Ikkje vis profilsida
|
|
function remove_bbpress_profile_page() {
|
|
if (function_exists('bbp_is_single_user')) {
|
|
if (bbp_is_single_user()) {
|
|
//wp_redirect(home_url()); // Omdirigerer til hjemmesiden
|
|
wp_redirect(home_url('forums/')); // Omdirigerer til hjemmesiden
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
//add_action('template_redirect', 'remove_bbpress_profile_page');
|
|
|
|
|
|
function remove_private_title_prefix($title) {
|
|
// Fjern "Privat:" fra tittelen
|
|
$title = str_replace('Privat: ', '', $title);
|
|
return $title;
|
|
}
|
|
add_filter('the_title', 'remove_private_title_prefix');
|
|
|
|
|
|
// Logg-ut-knapp
|
|
function add_logout_button() {
|
|
if (is_user_logged_in()) {
|
|
echo '<a href="' . wp_logout_url(home_url()) . '">Logg ut</a>';
|
|
}
|
|
}
|
|
|
|
// Change default WordPress email address
|
|
add_filter('wp_mail_from', 'new_mail_from');
|
|
add_filter('wp_mail_from_name', 'new_mail_from_name');
|
|
|
|
function new_mail_from($old) { return 'info@taubaneforeningen.no'; }
|
|
|
|
function new_mail_from_name($old) { return 'Norske Tau- og Kabelbaners Forening'; }
|
|
//end: Change default WordPress email address
|
|
?>
|