prefix . 'posts'; mysql_query("ALTER TABLE " . $posts_table . " ADD show_in_menu TINYINT(1) DEFAULT 1 NOT NULL AFTER post_title"); mysql_query("ALTER TABLE " . $posts_table . " ADD alt_link_text VARCHAR(60) AFTER show_in_menu"); mysql_query("ALTER TABLE " . $posts_table . " ADD alt_title_attribute VARCHAR(100) AFTER alt_link_text"); } // DEACTIVATION function wp_alt_link_text_uninstall() { global $wpdb; $posts_table = $wpdb->prefix . 'posts'; // If the following lines are uncommented, deactivating the plugin will remove any trace of it mysql_query("ALTER TABLE " . $posts_table . " DROP show_in_menu"); mysql_query("ALTER TABLE " . $posts_table . " DROP alt_link_text"); mysql_query("ALTER TABLE " . $posts_table . " DROP alt_title_attribute"); } // ADD FIELD function wp_alt_link_text_add_field() { if (function_exists('add_meta_box')) { add_meta_box('alt_link_text_box', 'Alt-Link-Text', 'alt_link_text_inner', 'page', 'normal', 'low'); } } function alt_link_text_inner() { global $post, $show_in_menu, $alt_link_text, $alt_title_attribute; ?>
show_in_menu == 1) { echo ' checked="checked"'; } ?> /> If this box is checked, then this Page will appear in page lists generated using wp_list_pages().
This link text will be used in page lists generated using wp_list_pages().
This title attribute will be used in page lists generated using wp_list_pages().
prefix . 'posts'; if ($_POST[show_in_menu]) { mysql_query("UPDATE " . $posts_table . " SET show_in_menu = '1' WHERE ID = $_POST[ID]"); } else { mysql_query("UPDATE " . $posts_table . " SET show_in_menu = '0' WHERE ID = $_POST[ID]"); } if ($_POST[alt_link_text] == "") { mysql_query("UPDATE " . $posts_table . " SET alt_link_text = null WHERE ID = $_POST[ID]"); } else { mysql_query("UPDATE " . $posts_table . " SET alt_link_text = '" . $_POST[alt_link_text] . "' WHERE ID = $_POST[ID]"); } if ($_POST[alt_title_attribute] == "") { mysql_query("UPDATE " . $posts_table . " SET alt_title_attribute = null WHERE ID = $_POST[ID]"); } else { mysql_query("UPDATE " . $posts_table . " SET alt_title_attribute = '" . $_POST[alt_title_attribute] . "' WHERE ID = $_POST[ID]"); } } // EXCLUDE PAGES FROM PAGE LIST function page_exclusions($page_exclusions) { global $wpdb; $posts_table = $wpdb->prefix . 'posts'; $page_exlusions_data = mysql_query("SELECT ID FROM " . $posts_table . " WHERE show_in_menu = '0' AND post_status = 'publish'"); while ($row = mysql_fetch_assoc($page_exlusions_data)) { extract($row); $page_exclusions[] = $ID; } return $page_exclusions; } // REPLACE TITLES IN WP-LIST-PAGES RESULTS function wp_alt_link_text($output) { global $wpdb; $posts_table = $wpdb->prefix . 'posts'; $alt_link_text_data = mysql_query("SELECT post_title, alt_link_text FROM " . $posts_table . " WHERE alt_link_text IS NOT NULL AND post_status = 'publish'"); while ($row = mysql_fetch_assoc($alt_link_text_data)) { extract($row); $post_title = wptexturize($post_title); $post_title = convert_chars($post_title); $post_title = trim($post_title); $output = preg_replace('`>' . $post_title . '<`', '>' . $alt_link_text . '<', $output); } $alt_title_attribute_data = mysql_query("SELECT post_title, alt_title_attribute FROM " . $posts_table . " WHERE alt_title_attribute IS NOT NULL AND post_status = 'publish'"); while ($row = mysql_fetch_assoc($alt_title_attribute_data)) { extract($row); $post_title = wptexturize($post_title); $post_title = convert_chars($post_title); $post_title = trim($post_title); $output = preg_replace('`title="' . $post_title . '"`', 'title="' . $alt_title_attribute . '"', $output); } return $output; } ?>