Last active
March 15, 2016 09:48
-
-
Save yratof/fb44bcd7a743c177b039 to your computer and use it in GitHub Desktop.
ACF: Add a field name to the title of the flex field for easier management
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
<script type="text/javascript" defer="defer"> | |
( function( $ ) { | |
acf.add_action('load', function( $el ){ | |
$( 'div.values > [data-layout="product_category"]' ).each( function(){ | |
var $name = $( '[data-name="menu_item_name"] input[type="text"]', $( this ) ); | |
var $fallback = $( '.select2-chosen', $( this ) ); | |
$name = $name.clone().val(); | |
$fallback = $fallback.clone().text(); | |
$name = $name + ' / ' + $fallback; | |
var $title = $( '.acf-fc-layout-handle', $( this ) ); | |
var $strong = $( '<strong>' ); | |
$strong.append( $name ); | |
$strong.appendTo( $title ); | |
}); | |
}); | |
} ( jQuery ) ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Such a dick ACF.