Skip to content

Commit

Permalink
last tab issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
codersaiful committed Apr 30, 2024
1 parent 7680bbd commit e53f5be
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion admin/post_metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ function wpt_redirect_after_save($location, $post_id) {
// Check if it's the desired post type
if (get_post_type($post_id) == 'wpt_product_table') {
// Append the desired anchor to the redirect location
$location = add_query_arg('message', 'updated', $location) . '#' . $wpt_last_active_tab;
$location = add_query_arg('message', 'updated', $location);
$location = add_query_arg('wpt_active_tab', $wpt_last_active_tab, $location);
}
return $location;
Expand Down
2 changes: 1 addition & 1 deletion admin/post_metabox_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
using: setLastActiveTab(tabName); from js code
-->
<!-- add_filter('redirect_post_location', 'wpt_redirect_after_save', 10, 2); see from post_metabox.php file -->
<input type="hidden" name="wpt_last_active_tab" id="wpt-last-active-tab" value="">
<input type="hidden" name="wpt_last_active_tab" id="wpt-last-active-tab" value="<?php echo esc_attr( $wpt_active_tab ) ?>">
<?php
//Now start for Tab Content
$active_tab_content = 'tab-content-active';
Expand Down
4 changes: 2 additions & 2 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ jQuery.fn.extend({
var selectLinkTab = $(selectLinkTabSelector);
var selectTabContent = $(selectTabContentSelector);
var tabName = window.location.hash.substr(1);
setLastActiveTab(tabName);
if (tabName) {
setLastActiveTab(tabName);
removingActiveClass();
$('body.wpt_admin_body #wpt_configuration_form #' + tabName).addClass('tab-content-active');
$('body.wpt_admin_body #wpt_configuration_form .nav-tab-wrapper a.wpt_nav_tab.wpt_nav_for_' + tabName).addClass('nav-tab-active');
Expand All @@ -402,7 +402,7 @@ jQuery.fn.extend({
setLastActiveTab(targetTabContent);
// Detect if pushState is available
if(history.pushState) {
history.pushState(null, null, $(this).attr('href'));
// history.pushState(null, null, $(this).attr('href'));
}

removingActiveClass();
Expand Down

0 comments on commit e53f5be

Please sign in to comment.