Skip to content

Instantly share code, notes, and snippets.

@wpeasy
Created October 1, 2023 00:57
Show Gist options
  • Save wpeasy/2b740b14721f00516fc7e6aa0614e283 to your computer and use it in GitHub Desktop.
Save wpeasy/2b740b14721f00516fc7e6aa0614e283 to your computer and use it in GitHub Desktop.
Grouping WordPress CPTs
#adminmenu [id*="menu-posts-"]{
background-color: var(--bricks-color-primary);
}
#adminmenu [id*=menu-posts-] > a {
color: black;
}
#adminmenu [id*=menu-posts-] > a .wp-menu-image::before{
color: black;
}
/* CPT Label */
#adminmenu li.cpt-menu {
padding: 0.25rem ;
display: block;
border: 1px solid rgba(255,255,255,.4);
border-radius: 30px;
color: #ffffffbb;
margin: 0.25rem ;
line-height: 1;
font-size: 10px;
font-weight: bold;
}
(()=>{
const myItems = document.querySelectorAll('[id*="menu-posts-"]');
const li = document.createElement("li");
li.textContent = 'Custom Post Types';
li.classList.add('cpt-menu');
const parent = myItems[0].parentNode;
parent.insertBefore(li, myItems[0]);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment