Skip to content

Commit

Permalink
Update wpscp-fullcalendar-config.js
Browse files Browse the repository at this point in the history
  • Loading branch information
alimuzzaman committed Jun 5, 2022
1 parent 047654e commit bd4eb19
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions assets/js/wpscp-fullcalendar-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ document.addEventListener('DOMContentLoaded', function () {
post_status: modalStatus.val(),
ID: postID.val(),
postTitle: modalTitle.val(),
post_type: wpscpGetPostTypeName(),
post_type: wpscpGetPostTypeName(postID.val()),
postContent: modalContent.val(),
})

Expand Down Expand Up @@ -614,9 +614,12 @@ document.addEventListener('DOMContentLoaded', function () {
/**
* Get Post Type Name form Query Sting
*/
function wpscpGetPostTypeName() {
function wpscpGetPostTypeName(postID) {
var urlParams = new URLSearchParams(window.location.search)
var postTypeName = urlParams.get('post_type')
if(!postTypeName && postID){
postTypeName = jQuery('[data-postid=' + postID + ']').data('post-type');
}
return postTypeName == null || postTypeName == ''
? 'post'
: postTypeName
Expand Down

0 comments on commit bd4eb19

Please sign in to comment.