0
我得到了一个插件的错误,我想知道是否有快速修复。WordPress插件页脚菜单错误
我已经搜索了这个问题并检查了插件网站的创建者。没有帮助。
的插件需要:
<?php do_shortcode('[print_wp_footer]'); ?>
添加到Footer.php为主题。
的WordPress然后给出一个错误:
Warning: Invalid argument supplied for foreach() in /.../wp-content/plugins/wp-footer-menu/main.php on line 192
这里是由自身
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
一旦我添加,错误消失。那么菜单必须是空的。 – 2013-03-22 22:00:18
然后+1他的答案,并将其标记为已解决。 – 2013-03-23 00:36:33