WordPress自定义插件页面重定向

瓦西姆·谢赫(Vasim shaikh)

开发插件,但是当我单击管理菜单工作和管理页面打开时,但是当我单击页面锚链接时,它不起作用给出错误(附件)。

代码要点:

<?php

/**
*Plugin Name: my name
*Plugin URI: url for ref
*Description: my desciop
*Version:1.0.0.0
*Author:xyz
**/



function ShareEmbed()
{
    global $current_user;   
    $user_ID = get_current_user_id();
    global $wpdb;
    $user_guid = $wpdb->get_results("SELECT wp_guid FROM wp_users where id=".$user_ID);
    print_r($user_guid); 


    ?>

    <div class="wrapper">   
    <div class="blog-embed">
        <span><h3>Code for share</h3></span>
        <textarea readonly=""><a href='example.com?bloggerrefid='><img src='example.com/wp-content/uploads/2016/04/logo.png' alt='logo' width='' border='0'></a></textarea>     
    </div>
    <div class="blog-embed-help">
        <h3>How to configure afflication program?</h3>
        <ul>
        <li><b>Step-1:</b>login into your blog/website account.</li>
        <li><b>Step-2:</b>copy above embed code</li>
        <li><b>Step-3:</b>Paste code into your site area as html block</li>
        <li><b>Step-4:</b>Save changes.</li>
        <li><b>Step-5:</b>That's it.We are done with this.Once any one click on this link it consider as a hit.</li>
        </ul>

    </div>
    </div>
    <?php
}

add_shortcode('shareblog','ShareEmbed');

/**
 * Register a custom menu page.
 */
function wpdocs_register_my_custom_menu_page() {
    add_menu_page(
        __( 'Custom Menu Title', 'textdomain' ),
        'ShareThis',
        'manage_options',
        'wp-blogger-share-this/wp-blogger-share-this-admin.php',
        '',
       'dashicons-networking', 6
       );
}
add_action( 'admin_menu', 'wpdocs_register_my_custom_menu_page' );

管理员档案:

<?php
            global $wpdb;
            $current_guid=null;
            $user_guids = $wpdb->get_results("SELECT DISTINCT wp_guid FROM wp_blogger_data");
?><table border=1 width="100%">
            <tr><th width='30%'>User Name</th>  <th width='30%'>Total Hits</th> <th width='30%'>Unique Hits</th><TH>-</TH>?</tr>

            <?php

            foreach ($user_guids as $user_guid) {
                         $username_by_GUID = $wpdb->get_row("SELECT `user_login` FROM `users` where `wp_guid` = '$user_guid->wp_guid'");
                         $unique_hits = $wpdb->get_row("SELECT COUNT(DISTINCT `ip_address`) AS `unique_hits` FROM `tb1` where `wp_guid`='$user_guid->wp_guid'");
                         $total_hits = $wpdb->get_row("SELECT COUNT(`ip_address`) AS `total_hits` FROM `tb1` where `wp_guid` = '$user_guid->wp_guid'");
                        ?>
                        <tr><td><?php echo $username_by_GUID->user_login;?></td>
                        <?php
                        echo "<td>".$total_hits->total_hits."</td>";
                        echo "<td>".$unique_hits->unique_hits."</td>";  
                        ///wp-admin/admin.php?page=

wp-detail-view.php?id = wp_guid; ?>“>删除?>

页面问题,我要在此页面上浏览以查看详细信息。

wp-detail-view.php

<?php

echo "You are on Details view";

在此处输入图片说明

瓦西姆·谢赫(Vasim shaikh)

在这里,我们需要在主页内包含页面,并取决于查询string.include文件和输出。

<?php

            if(!isset($_GET['blogerid'])){
            global $wpdb;
            $current_guid=null;
            $user_guids = $wpdb->get_results("SELECT DISTINCT wp_guid FROM wp_blogger_data");
?><table border=1 width="100%">
            <tr><th width='30%'>User Name</th>  <th width='30%'>Total Hits</th> <th width='30%'>Unique Hits</th></tr>

            <?php

            foreach ($user_guids as $user_guid) {
                         $username_by_GUID = $wpdb->get_row("SELECT `ID`,`user_login` FROM `wp_users` where `wp_guid` = '$user_guid->wp_guid'");
                         $unique_hits = $wpdb->get_row("SELECT COUNT(DISTINCT `ip_address`) AS `unique_hits` FROM `wp_blogger_data` where `wp_guid`='$user_guid->wp_guid'");
                         $total_hits = $wpdb->get_row("SELECT COUNT(`ip_address`) AS `total_hits` FROM `wp_blogger_data` where `wp_guid` = '$user_guid->wp_guid'");
                        ?>
                        <tr><td><?php echo $username_by_GUID->user_login;?></td>
                        <?php
                        echo "<td>".$total_hits->total_hits."</td>";
                        echo "<td>".$unique_hits->unique_hits."</td>";  
                        ///wp-admin/admin.php?page=wp-blogger-detail-view.php?id=<?php echo $user_guid->wp_guid;
                        ?>
                        <td><a href="<?php echo get_admin_url()."admin.php?page=wp-blogger-share-this/wp-blogger-share-this-admin.php&blogerid=$username_by_GUID->ID";?>">Delete</a></td>
            <?php
            }               
            ?> 
            </table>
<?php
            }
else
{

        include 'wp-blogger-detail-view.php';
}   

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

将自定义页面重定向到产品标签

Nginx 301重定向自定义页面无效,仍返回其中包含“ nginx”的页面

.NET Core从Startup.cs重定向到自定义错误页面

从自定义模板重定向WordPress

Laravel Passport Oauth自定义页面/自动重定向

Spring Security将自定义登录页面重定向到其自身-重定向过多

如何自动注销用户并使用WordPress中的自定义消息将其重定向到登录页面

javascript 404页面自定义重定向失败

WordPress自定义帖子类型表单重定向到找不到页面

如果页面中有错误,请重定向到自定义错误页面

重定向到自定义404错误页面

将根/主页重定向到自定义页面会破坏.htaccess中的所有其他重定向

Grails安全插件自定义重定向

wordpress插件从页面重定向到页面许可错误

将Wordpress帖子重定向到自定义php页面

nginx默认重定向和自定义重定向

Azure 重定向到自定义 404 页面

使用 mod_rewrite 重定向 ErrorDocument 自定义页面 (500,503)?

从 WordPress 插件重定向到 404 页面

使用 htacess 将所有自定义页面重定向到专用页面

Wordpress 太多重定向自定义功能

Woocommerce 丢失密码重定向到 wordpress 忘记密码但不是我的自定义忘记密码页面

登录后如何重定向到自定义页面?

从另一个自定义重定向到自定义 html 页面

如何在剃刀页面中重定向到自定义 404 页面

ADB2C 自定义策略 - 登录后重定向到源页面

重定向不适用于自定义插件 wordpress

无法使用 Razor 页面(net core 3.1)将错误重定向到自定义页面

尝试输入任何匹配的字母时,WordPress 重定向到自定义帖子单个帖子页面