Created
July 12, 2016 11:39
-
-
Save sidonaldson/5cdd310d0259b06dee10def30d89dba4 to your computer and use it in GitHub Desktop.
Amend to Yoast ACF SEO Analysis
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
YoastACFAnalysis.prototype.addAcfFieldsToContent = function(data) { | |
var acf_content = ' ', | |
parents = $('#post-body, #edittag'); | |
// get text content | |
parents.find('input[type="text"][id^="acf"][value != ""][class != "wp-color-picker"], textarea[id^="acf"]:not(:empty)').each(function() { | |
acf_content += ' ' + $(this).val(); | |
}); | |
// get url content | |
parents.find('input[type="url"][id^="acf"][value != ""]').each(function() { | |
acf_content += ' <a href="' + $(this).val() + '">' + $(this).val() + '</a>'; | |
}); | |
// get image content | |
parents.find('.acf-image-uploader img[data-name="image"][src != ""]').each(function() { | |
acf_content += ' <img src="' + this.src + '" alt="' + this.alt + '" />'; | |
}); | |
data = data + acf_content; | |
return data.trim(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment