forked from hultsfredskommun/hultsfredskommun
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhk_redirect_page.php
42 lines (37 loc) · 1.21 KB
/
hk_redirect_page.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* Template Name: Enkel adress till sida
* Description: Skickar vidare användaren direkt till adressen som står i sidinnehållet. Om innehållet är tomt så skickas man till startsidan.
*/
define('WP_USE_THEMES', false);
require('./wp-blog-header.php');
if ($post) {
setup_postdata($post);
$text = "";
if (function_exists("get_field")) {
$url = get_field("hk_redirect_link");
$text = get_field("hk_redirect_text");
}
else {
$url = strip_tags(get_the_content(""));
}
if (substr($url, 0, 1) == "/") {
$url = get_site_url() . $url;
}
} ?>
<?php if ($url != "") :
//header("Location: $url");
//echo "<meta http-equiv='refresh' content='0;url=$url'>";
endif;
if ($url != "") : ?>
<html><head><?php echo "<meta http-equiv='refresh' content='0;url=$url'>"; ?></head><body>
<?php
$hk_options = get_option('hk_theme');
echo $hk_options['in_topbody_section'];
echo $text;
?><br /><br /><p>Du skickas nu vidare till </p><p><b><?php echo $url; ?></b></p></body></html>
<?php else : ?>
<html><head></head><body>Ingen enkel adress hittades.</body></html>
<?php
endif;
/*if ($url != "") : wp_redirect( $url, 301 ); exit; else : echo "Ingen enkel adress hittades."; endif;*/?>