function insert_wp_about_author($content) { $wp_about_author_settings = wp_about_author_get_options(); if (is_front_page() && isset($wp_about_author_settings['wp_author_display_front']) && $wp_about_author_settings['wp_author_display_front']) { $content .= wp_about_author_display(); } else { if (is_archive() && isset($wp_about_author_settings['wp_author_display_archives']) && $wp_about_author_settings['wp_author_display_archives']) { $content .= wp_about_author_display(); } else { if (is_search() && isset($wp_about_author_settings['wp_author_display_search']) && $wp_about_author_settings['wp_author_display_search']) { $content .= wp_about_author_display(); } else { if (is_page() && isset($wp_about_author_settings['wp_author_display_pages']) && $wp_about_author_settings['wp_author_display_pages']) { $content .= wp_about_author_display(); } else { if (is_single() && isset($wp_about_author_settings['wp_author_display_posts']) && $wp_about_author_settings['wp_author_display_posts']) { $content .= wp_about_author_display(); } else { if (is_feed() && isset($wp_about_author_settings['wp_author_display_feed']) && $wp_about_author_settings['wp_author_display_feed']) { $content .= wp_about_author_display(true); } else { $content = $content; } } } } } } return $content; }
function wp_about_author_process_settings() { $fields = wp_about_author_get_options(); if (!empty($_POST['wp_about_author_option_submitted'])) { $wp_about_author_settings = array(); if (strstr($_GET['page'], "wp-about-author") && check_admin_referer('wp-about-author-update-options')) { $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['wp_author_alert_bg']); if ((strlen($color) == 6 || strlen($color) == 3) && isset($_POST['wp_author_alert_bg'])) { $wp_about_author_settings['wp_author_alert_bg'] = $_POST['wp_author_alert_bg']; } foreach ($fields as $field_key => $field_value) { if (isset($_POST[$field_key])) { $wp_about_author_settings[$field_key] = $_POST[$field_key]; } else { $wp_about_author_settings[$field_key] = ""; } } echo "<div id=\"updatemessage\" class=\"updated fade\"><p>WP About Author settings updated.</p></div>\n"; echo "<script type=\"text/javascript\">setTimeout(function(){jQuery('#updatemessage').hide('slow');}, 3000);</script>"; update_option('wp_about_author_settings', $wp_about_author_settings); } } //updated $wp_about_author_settings = get_option('wp_about_author_settings'); $wp_about_author_settings = wp_parse_args($wp_about_author_settings, $fields); return $wp_about_author_settings; }