Created
August 17, 2021 21:37
-
-
Save taotiwordpress/b57ccbff1fa2930025f67b2548ed4350 to your computer and use it in GitHub Desktop.
[acf page builder preview] then add preview folder to inc/acf/ #acf #dashboard #admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add ACF Content Blocks preview images. | |
jQuery(document).ready(function ($) { | |
if (typeof acf !== 'undefined') { | |
acf.addAction('load', () => { | |
$('.tmpl-popup').each((_, popup) => { | |
const regex = /data-layout="(.+?)".*?>/g; | |
const replace = `$&<img src="${taoti_admin_js.acfPreviewUrl}$1.jpg">`; | |
const result = $(popup).html().replace(regex, replace); | |
$(popup).html(result); | |
}); | |
}); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment