Php WordPress插件页脚菜单错误

Php WordPress插件页脚菜单错误,php,wordpress,Php,Wordpress,我得到了一个开箱即用的插件错误,我想知道是否有一个快速修复 我在谷歌上搜索了这个问题,并查看了插件网站的创建者。没有帮助 插件需要: <?php do_shortcode('[print_wp_footer]'); ?> 这是电话线本身 foreach ($values as $attr=>$val) { 这是代码的一部分,第192行带有箭头 <?php } function wp_footer_menu_confirm_delete ($delete) {

我得到了一个开箱即用的插件错误,我想知道是否有一个快速修复

我在谷歌上搜索了这个问题,并查看了插件网站的创建者。没有帮助

插件需要:

<?php do_shortcode('[print_wp_footer]'); ?>
这是电话线本身

foreach ($values as $attr=>$val) {
这是代码的一部分,第192行带有箭头

<?php


}

function wp_footer_menu_confirm_delete ($delete) {

$base_uri = wp_footer_menu_base_uri();

// Find out about this menu item.
$menu_items = get_option ( 'footer_menu_links' );
$item_to_delete = explode( ',', $menu_items[$delete] );
$item_title = $item_to_delete[0];
$item_address = $item_to_delete[1];

// Create form for user to confirm option.
echo '<h3>Confirm Delete</h3>';
echo '<p>Are you sure you want to delete this menu item?</p>';
echo '<p>Title: ' . $item_title . '</p>' ;
echo '<p>Address: ' . $item_address . '</p>';
echo '<form method="post" action="' . $base_uri . '">';
echo '<input type="hidden" name="delete_key" value="' . $delete . '" />';
echo wp_nonce_field( 'confirm_delete', 'delete' );
echo '<input type="submit" class="button-primary" value="Delete item" />';
echo '</form>';

}

function wp_footer_menu_process() {

if ( isset( $_GET[ 'delete' ] ) ) {
    $nonce = $_GET ['nonce'];
    if ( wp_verify_nonce( $nonce, 'footer_delete' ) ) {
        wp_footer_menu_confirm_delete ( $_GET[ 'delete' ] );
    }
    return 0;
} else if ( isset( $_POST[ 'delete_key' ] ) && check_admin_referer ( 'confirm_delete', 'delete' ) ) {

    $menu_items = get_option ( 'footer_menu_links' );
    $key = $_POST['delete_key'];
    unset ( $menu_items[$key] );
    update_option ( 'footer_menu_links', $menu_items );

}

if ( isset( $_POST[ 'link_title' ] ) && check_admin_referer( 'footer_menu', 'add' ) ) {

    $link_title = $_POST ['link_title'];
    $link_address = $_POST ['link_address'];
    $link_order = $_POST ['link_order'];
    $new_link = $link_title . ',' . $link_address . ',' . $link_order;

    $footer_links = get_option( 'footer_menu_links' );
    if ($footer_links == '') {
        $footer_links = array();
    }
    $new_links = array_push( $footer_links, $new_link );
    update_option ( 'footer_menu_links', $footer_links );
}

if ( isset( $_POST[ 'font-size' ] ) && check_admin_referer( 'footer_menu', 'save' ) ) {
    if (empty($_POST['auto-footer'])) {
        $_POST['auto-footer'] = 'no';
    }
    if (empty($_POST['auto-sticky'])) {
        $_POST['auto-sticky'] = 'no';
    }
    update_option('wp_footer_values', $_POST);
    echo '<div class="wp_footer_info" style="margin:0 auto;margin-top:5px;text-align:center;">Customizations Saved</div>';
}

return 1;

}

function wp_footer_print_menu() {
$menu = wp_footer_get_menu();
$values = get_option('wp_footer_values');
--192-->    foreach ($values as $attr=>$val) {
    $menu = str_replace('%' . $attr . '%', stripslashes($val), $menu);
}
echo $menu;
if ($values['auto-sticky'] == 'yes') {
    ?>
    <style type="text/css">
        .wp_footer_sticky {
            position:fixed;
            bottom: 0;
            width: 100%;
        }
    </style>
    <script type="text/javascript">
        jQuery(document).ready(function($) {
            $('#wp_footer_menu').addClass('wp_footer_sticky');
        });
    </script>
    <?php

.wp_页脚_粘性{
位置:固定;
底部:0;
宽度:100%;
}
jQuery(文档).ready(函数($){
$('wp#u footer_menu').addClass('wp#footer_sticky');
});

它似乎取决于以下代码的返回值:

$values = get_option('wp_footer_values');
根据WordPress代码,如果该选项不存在,则返回布尔值FALSE。到,您需要验证
$values
变量是否为空。使用以下代码进行检查

function wp_footer_print_menu() {
$menu = wp_footer_get_menu();
$values = get_option('wp_footer_values');
if (!empty($values)) { // <-- verify it's not empty
  foreach ($values as $attr=>$val) {
    $menu = str_replace('%' . $attr . '%', stripslashes($val), $menu);
  }
  echo $menu;
  // [...}
} // <-- don't forget to close the if statement just after the end of the foreach statement
函数wp\u footer\u print\u menu(){
$menu=wp_footer_get_menu();
$values=get_选项(“wp_页脚_值”);

如果(!empty($values)){//一旦我添加了它,错误就消失了。那么菜单必须是空的。
function wp_footer_print_menu() {
$menu = wp_footer_get_menu();
$values = get_option('wp_footer_values');
if (!empty($values)) { // <-- verify it's not empty
  foreach ($values as $attr=>$val) {
    $menu = str_replace('%' . $attr . '%', stripslashes($val), $menu);
  }
  echo $menu;
  // [...}
} // <-- don't forget to close the if statement just after the end of the foreach statement