I'm using WordPress and I need to get part of a class name stored in the body tag.
I would like to extract word(s) after post-type prefix.
<body class="post-php post-type-dissertation is-fullscreen-mode wp-embed-responsive customize-support svg">
<body class="post-php post-type-subject-imposed is-fullscreen-mode wp-embed-responsive customize-support svg">
In my examples I would like to get dissertation or subject-imposed after post-type prefix.
With my code I get all classes after post-type
var $cn = jQuery('body[class*="post-type"]').attr('class');
console.log($cn.split('post-type-')[1]);
Example of output :
dissertation is-fullscreen-mode wp-embed-responsive customize-support svg
How can I delete all others classes and keep dissertation or subject-imposed words ?