I am currently developing a plugin for a gym where the admin can manage all the gym members in admin area through create/add new members, view/read, edit and delete them. I first started off by creating custom menu item (add_menu_page - "Badar's Gym") and a sub menu ("Add Member") under that. I have completed the "Adding member" part, which saves all the fields in a custom table in WordPress database and "Showing all the entries part" on page where it says "Angel Builder Dashboard". Here are the screenshots.
The problem here is i want to show a full detailed page for a particular member/entry when the view button is clicked(also for edit). Normally in php projects you create a view.php(or something similar) page and show a particular entry there. How i can achieve that here without creating a new add_menu_page?
One more problem i am facing here is after the add member form has been submitted i try to redirect the user to "badar's Gym" page where it lists all the entries using wp_redirect() but it gives me these errors:-
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-includes\formatting.php:5652) in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 1265
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\wordpress\wp-includes\formatting.php:5652) in C:\xampp\htdocs\wordpress\wp-includes\pluggable.php on line 1268
Here is my code for redirecting:-
if (isset($_POST['submit_add_member'])) {
//Performs all validation and other tasks here
......
....
..
//Redirect user to main plugin page(Dashboard) if no errors are found
$badar_redirect_url = admin_url('admin.php?page=badar-gym');
//--------------------Redirection needs to be fixed, it is outputting headers already sent error
wp_redirect( $badar_redirect_url );
}//End If statement
}//End If statement
I am fairly new to WordPress so any help would be appreciated :)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744948380a4602762.html
评论列表(0条)