I am trying to use : hidden link in wp-admin in edit post
Link to a page where the issue can be seen:hidden link
I expected to see working ui sortable
With wp types beta version plugin, there are some jquery error and because of that my ui sortable is not working.
Please check attached screen shot.
Hello,
I assume you are using custom codes to build your ui sortable in the wordpress admin side, which is not compatible with beta version of Types plugin.
If it is, please describe detail steps to duplicate same problem:
How do you setup the ui sortable in the wordpress admin side?
How can I see the screenshot you mentioned above:
hidden link
I need to duplicate same problem and debug it in my localhost.
In the mean time, since it is a custom codes problem, according to our support policy:
https://toolset.com/toolset-support-policy/
We cannot produce custom code solutions for you. When you need custom coding which extends Toolset functionality, we recommend contacting one of Toolset certified consultants:
https://toolset.com/contractors/
Yes, I am doing custom code for ui sortable. Let me explain you.
I have added below code in functions.php file
//enqueue scripts and style in wp-admin
function datatable_assets($hook) {
if( $hook != 'post.php' )
return;
//enqueue css files
wp_enqueue_style('reorderscss', get_stylesheet_directory_uri() . '/css/jquery-ui.css');
//enqueue js files
wp_enqueue_script('jqueryuijs', get_stylesheet_directory_uri() . '/js/jquery-ui.js');
wp_enqueue_script('admin_custom', get_stylesheet_directory_uri() . '/js/admin_custom.js');
}
add_action('admin_enqueue_scripts', 'datatable_assets');
//add metabox in edit custom post type
/**
* Register meta box(es).
*/
function lesson_order() {
add_meta_box('meta-box-id', __('Lesson Order', 'textdomain'), 'lesson_order_callback', 'course');
}
add_action('add_meta_boxes', 'lesson_order');
/**
* Meta box display callback.
*
* @param WP_Post $post Current post object.
*/
function lesson_order_callback($post) {
echo "Here you can set the order of the lessons in this course. The lessons will be shown in the same order on the course overview page.<br>Here comes a drag and drop box for ordering the lessons in this course.<br><br>";
global $wpdb;
$courseid = $post->ID;
$table_name = $wpdb->prefix . "toolset_associations";
$lessonids = $wpdb->get_results( "SELECT child_id FROM $table_name where parent_id = ".$courseid);
foreach($lessonids as $lessonid){
echo '<ul id="sortable">';
echo '<li class="ui-state-default">'.get_the_title($lessonid->child_id)."</li>";
echo '</ul>';
}
}
//jquery for ui sortable in admin_custom.js file
jQuery(document).ready(function() {
jQuery( "#sortable" ).sortable();
});
How can I see the screenshot you mentioned above:
hidden link
Ans : If you want see above page, Mark my next reply as private so I can provide you admin details.
Error mentioned in above screenshot is coming without my code.. As you can see there is no error related to ui sortable.
But, I suspect that because of those error coming my ui sortable code is not working..
Thanks!!
Thanks for the details, I can see the problem in your codes, the problem is in the "foreach" loop, please modify these codes from:
foreach($lessonids as $lessonid){
echo '<ul id="sortable">';
echo '<li class="ui-state-default">'.get_the_title($lessonid->child_id)."</li>";
echo '</ul>';
}
To:
echo '<ul id="sortable">';
foreach($lessonids as $lessonid){
echo '<li class="ui-state-default">'.get_the_title($lessonid->child_id)."</li>";
}
echo '</ul>';
And test again.