Created
February 22, 2019 17:32
-
-
Save plpepin/de6fe478be80c11de4c33a7aee3f1ff2 to your computer and use it in GitHub Desktop.
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
// Where is the code going? | |
cssSel_Content = .somedialog .dialog__content; | |
$dlgContent = jQuery( cssSel_Content ); | |
// Grab the content and paste it inside its destination | |
wordpress_site_url = 'http://www.somesite.com'; | |
wordpress_page_slug = 'some-page-slug'; | |
jQuery.get( wordpress_site_url + '/wp-json/wp/v2/pages', { | |
slug: wordpress_page_slug, | |
per_page: 1 | |
}, function( pages ) { | |
gridContent = pages[0].grid; // returned variable is an array ;) | |
pageContentRows = JSON.parse( gridContent ).cont; // content returns all rows as an array | |
jQuery.each(pageContentRows, function(index, content) { | |
$dlgContent.append( content.cont ); | |
}); | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment