Skip to content

Instantly share code, notes, and snippets.

@chrisjangl
Created June 14, 2023 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisjangl/0e77a30717b4ebc4b4c5a5b3d0745b41 to your computer and use it in GitHub Desktop.
Save chrisjangl/0e77a30717b4ebc4b4c5a5b3d0745b41 to your computer and use it in GitHub Desktop.
[WP Pizza] Lists the enabled ingredients in an ingredient group when on the WP Pizza Ingredients page, Custom Groups tab
// set this to the ID of the group
var group = document.querySelector('#wppizza_addingredients-custom-group-96'),
// setting this as a variable in case it changes in the future
ingredientClass = 'wppizza_addingredients_ingrcg_sortable';
// find the ingredients that are enabled for this group
group.querySelectorAll('input[type="checkbox"]:checked').forEach(function(ingredient) {
// find the label for the ingredient
var label = ingredient.parentElement.innerText;
console.info(label);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment