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