Skip to content

Instantly share code, notes, and snippets.

@freddiemixell
Created October 8, 2018 20:40
Show Gist options
  • Select an option

  • Save freddiemixell/60702fcf474b80a0f9c4199c6057a97f to your computer and use it in GitHub Desktop.

Select an option

Save freddiemixell/60702fcf474b80a0f9c4199c6057a97f to your computer and use it in GitHub Desktop.
WordPress Open All Pages
let htmlCollection = document.getElementsByClassName("row-title");
let rowTitle = Array.from(htmlCollection);
rowTitle.map((t) => {t.setAttribute("onclick", "window.open(this.href);")})
function eventFire(el, etype){
if (el.fireEvent) {
el.fireEvent('on' + etype);
} else {
var evObj = document.createEvent('Events');
evObj.initEvent(etype, true, false);
el.dispatchEvent(evObj);
}
}
rowTitle.map((f) => {eventFire(f, 'click');});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment