wordpress自定义跳转链接代码示例

一、以下代码放入function.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
43
44
45
46
47
function corepress_jmp_message($message, $jumpUrl)
{
    global $set;
    ?>
    <!doctype html>
    <html lang="zh">
    <head>
        <?php get_header(); ?>
    </head>
    <body>
    <?php
    file_load_css('login-plane.css');
    ?>
    <div id="app" class="login-background">
        <header>
            <div class="header-main-plane">
                <div class="header-main container">
                    <?php
                    get_template_part('component/nav-header');
                    ?>
                </div>
            </div>
        </header>
        <div class="header-zhanwei" style="min-height: 80px;width: 100%;"></div>
        <main class="container">
            <div class="html-main"
                 style="background: #fff;padding: 20px;height: 100%;margin-bottom: 20px;font-size: 20px">
                <div>
                    <?php echo $message ?>
                    <div><a href="<?php echo $jumpUrl ?>">点击这儿</a>直接跳转</div>
                </div>
            </div>
        </main>
        <script>
            setTimeout(function () {
                location.replace('<?php echo $jumpUrl?>')
            }, 3000)</script>
        <footer>
            <?php
            wp_footer();
            get_footer(); ?>
        </footer>
    </div>
    </body>
    </html>
    <?php
}

二、使用方法

1
<?php corepress_jmp_message('跳转查看', https://xiaohost.com/);?>
原文链接:https://xiaohost.com/11030.html,转载请注明出处。
0

评论0

请先