mabufoysal
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: add_post_meta() & update_post_meta()Thanks @bcworkz . I am confused. If I use
update_post_meta()
where meta field for the post does not exist, then where should I useadd_post_meta()
?Forum: Fixing WordPress
In reply to: Save Multiple Metabox valuesThanks @bcworkz .
I have 3 fields like below image.
https://i.stack.imgur.com/pFq4Z.png
Should I use below code ?
if (isset($_POST[‘name’])) {
update_post_meta($post_id, ‘name’, sanitize_text_field($_POST[‘name’]));
}if (isset($_POST[‘address’])) {
update_post_meta($post_id, ‘address’, sanitize_text_field($_POST[‘address’]));
}if (isset($_POST[‘phone’])) {
update_post_meta($post_id, ‘phone’, sanitize_text_field($_POST[‘phone’]));
}Is there any way to Save multiple metabox values ?
Forum: Fixing WordPress
In reply to: Display list of Custom PostThanks @threadi . Yes, there is still a problem. The submenu item “API Key” is working. But I would like to make the list available as another submenu item of “News Info”.
Forum: Fixing WordPress
In reply to: Display list of Custom PostThanks @threadi . Yes, I want to have such an expanding menu.
My custom post type registration code is like below
public function register_custom_post_type () { $supports = array('title'); $labels = array( 'name' => _x('Newss', 'plural'), 'singular_name' => _x('News', 'singular'), 'name_admin_bar' => _x('News', 'admin bar'), 'add_new' => _x('Add New', 'add new'), 'add_new_item' => __('Add New News'), 'new_item' => __('New News'), 'edit_item' => __('Edit News'), 'view_item' => __('View News'), 'all_items' => __('All Newss'), 'search_items' => __('Search News'), 'not_found' => __('No News Found.'), ); $args = array( 'supports' => $supports, 'labels' => $labels, 'public' => true, 'description' => 'News Information', 'has_archive' => true, 'exclude_from_search' => false, 'show_in_menu' => 'edit.php?post_type=news' ); register_post_type('news', $args); }
My Menu code is like below
public function admin_menu() { add_menu_page(‘News Information’, ‘News Info’, ‘manage_options’, ‘news_info’, [$this, ‘api_key_page’], ‘dashicons-info-outline’, 30); add_submenu_page(‘news_info’, ‘News Information’, ‘API Key’, ‘manage_options’, ‘news_info_page’, [$this, ‘api_key_page’]); add_submenu_page(‘news_info’, ‘News Information’, ‘News’, ‘manage_options’, ‘edit.php?post_type=news’); remove_submenu_page(‘news_info’, ‘news_info’); }
Forum: Fixing WordPress
In reply to: Display list of Custom PostThanks @bcworkz . Yes, My CPT already have a submenu item to list news posts but I would like to attach it with another menu.
My custom post type registration code is like below
public function register_custom_post_type () { $supports = array('title'); $labels = array( 'name' => _x('News', 'plural'), 'singular_name' => _x('News', 'singular'), 'name_admin_bar' => _x('News', 'admin bar'), 'add_new' => _x('Add New', 'add new'), 'add_new_item' => __('Add New News'), 'new_item' => __('New News'), 'edit_item' => __('Edit News'), 'view_item' => __('View News'), 'all_items' => __('All Newss'), 'search_items' => __('Search News'), 'not_found' => __('No News Found.'), ); $args = array( 'supports' => $supports, 'labels' => $labels, 'public' => true, 'description' => 'News Information', 'has_archive' => true, 'exclude_from_search' => false, 'show_in_menu' => 'edit.php?post_type=news' ); register_post_type('news', $args); }
My Menu code is like below
public function admin_menu() { add_menu_page(‘News Information’, ‘News Info’, ‘manage_options’, ‘news_info’, [$this, ‘api_key_page’], ‘dashicons-info-outline’, 30); add_submenu_page(‘news_info’, ‘News Information’, ‘API Key’, ‘manage_options’, ‘news_info_page’, [$this, ‘api_key_page’]); add_submenu_page(‘news_info’, ‘News Information’, ‘News’, ‘manage_options’, ‘edit.php?post_type=news’); remove_submenu_page(‘news_info’, ‘news_info’); }
Forum: Fixing WordPress
In reply to: Display list of Custom PostThanks @threadi . Yes, I want to make this list available as a submenu item of “News Info”. Sorry for my poor English.
I am learning plugin development. That’s why I need coding solution. Thanks.
Forum: Fixing WordPress
In reply to: Display list of Custom PostThanks @gappiah . I am learning plugin development. That’s why I need coding solution. Thanks.
Forum: Fixing WordPress
In reply to: Sub Menu is not kept openThanks @t-p . My code is like below.
public function admin_menu()
{
add_menu_page(‘News Information’, ‘News Info’, ‘manage_options’, ‘news_info’, [$this, ‘api_key_page’], ‘dashicons-info-outline’, 30);
add_submenu_page(‘news_info’, ‘News Information’, ‘API Key’, ‘manage_options’, ‘news_info_page’, [$this, ‘api_key_page’]);
add_submenu_page(‘news_info’, ‘News Information’, ‘News’, ‘manage_options’, ‘edit.php?post_type=news’);
remove_submenu_page(‘news_info’, ‘news_info’);
}`
`I am getting output like below.
Forum: Fixing WordPress
In reply to: Metaboxes inside TabThanks @bcworkz . I would like to store additional data along with the custom post. How can I create a Custom Form with Tabs to save additional data ?
Forum: Fixing WordPress
In reply to: Insert Custom Post TypesThanks @bcworkz .
Forum: Fixing WordPress
In reply to: Insert Custom Post TypesThanks @bcworkz . I am learning WordPress plugin development. I need to insert Custom Post Type. I registered custom post type using
register_post_type()
. I am getting below Form when I am trying to insert a New Csutom Post Types (News).https://i.stack.imgur.com/ICDzD.png
**How can I customize this Form ?**
I would like to add some radio buttons and text fields here.
- This reply was modified 2 years, 6 months ago by mabufoysal.
Forum: Fixing WordPress
In reply to: Insert Custom Post TypesThanks @bcworkz . I would like to Insert Custom Post Types using a Form like below screenshot.
How can I do that ?
Forum: Fixing WordPress
In reply to: Admin Panel DevelopmentThanks @threadi.
Forum: Developing with WordPress
In reply to: How to pass multiple parameter in add_action()Thanks @sebastienserre
Forum: Fixing WordPress
In reply to: Using ComposerThanks @psykro