fetch()<\/code>-ed data from it, saved it to the WordPress database, parsed it, and applied it to some HTML markup to display on the front end. Not bad for a single tutorial, right?<\/p>\n\n\n\nAgain, we can do the same sort of thing so that the rankings render in the Block Editor in addition to the theme\u2019s front end. But hopefully keeping this focused on the front end shows you how fetching data works in a WordPress block, and how the data can be structured and rendered for display.<\/p>\n","protected":false},"excerpt":{"rendered":"
There\u2019ve been some new tutorials popping here on CSS-Tricks for working with WordPress blocks. One of them is an introduction to WordPress block development and it\u2019s a good place to learn what blocks are and to register them in WordPress for use in pages and posts. While the block basics are nicely covered in that […]<\/p>\n","protected":false},"author":288717,"featured_media":373964,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"Rendering External API Data in WordPress Blocks on the Front End by Manoj Kumar","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[4],"tags":[667,264,14583],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/09\/wordpress-blocks-api.jpg?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":374381,"url":"https:\/\/css-tricks.com\/rendering-external-api-data-in-wordpress-blocks-on-the-back-end\/","url_meta":{"origin":373952,"position":0},"title":"Rendering External API Data in WordPress Blocks on the Back End","date":"November 1, 2022","format":false,"excerpt":"This is a continuation of my last article about \"Rendering External API Data in WordPress Blocks on the Front End\". In that last one, we learned how to take an external API and integrate it with a block that renders the fetched data on the front end of a WordPress\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/09\/wordpress-blocks-api.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":375577,"url":"https:\/\/css-tricks.com\/saving-settings-for-a-custom-wordpress-block-in-the-block-editor\/","url_meta":{"origin":373952,"position":1},"title":"Saving Settings for a Custom WordPress Block in the Block Editor","date":"December 12, 2022","format":false,"excerpt":"We\u2019ve accomplished a bunch of stuff in this series! We created a custom WordPress block that fetches data from an external API and renders it on the front end. Then we took that work and extended it so the data also renders directly in the WordPress block editor. After that,\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/09\/wordpress-blocks-api.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":375098,"url":"https:\/\/css-tricks.com\/creating-a-settings-ui-for-a-custom-wordpress-block\/","url_meta":{"origin":373952,"position":2},"title":"Creating a Settings UI for a Custom WordPress Block","date":"November 17, 2022","format":false,"excerpt":"So far, we\u2019ve covered how to work with data from an external API in a custom WordPress block. We walked through the process of fetching that data for use on the front end of a WordPress site, and how to render it directly in the WordPress Block Editor when placing\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/09\/wordpress-blocks-api.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":341720,"url":"https:\/\/css-tricks.com\/code-blocks-but-better\/","url_meta":{"origin":373952,"position":3},"title":"Code blocks, but better","date":"June 1, 2021","format":false,"excerpt":"Pedro Duarte made a wishlist for styled code blocks in blog posts and documentation, then hand-rolls a perfect solution for that wishlist. For example, a feature to be able to highlight certain lines or words within the code block. The line highlighter is unique in that it only syntax highlights\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2021\/05\/Screen-Shot-2021-05-31-at-9.58.54-AM.png?fit=1200%2C521&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":374910,"url":"https:\/\/css-tricks.com\/managing-css-styles-in-a-wordpress-block-theme\/","url_meta":{"origin":373952,"position":4},"title":"Managing CSS Styles in a WordPress Block Theme","date":"November 7, 2022","format":false,"excerpt":"The way we write CSS for WordPress themes is in the midst of sweeping changes. I recently shared a technique for adding fluid type support in WordPress by way of theme.json, a new file that WordPress has been pushing hard to become a central source of truth for defining styles\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/11\/wordpress-logo-paintbrush.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":373732,"url":"https:\/\/css-tricks.com\/getting-started-with-wordpress-block-development\/","url_meta":{"origin":373952,"position":5},"title":"Getting Started With WordPress Block Development","date":"September 30, 2022","format":false,"excerpt":"Let\u2019s acknowledge that developing for WordPress is weird right now. Whether you\u2019re new to WordPress or have worked with it for eons, the introduction of \u201cFull-Site Editing\u201d (FSE) features, including the Block Editor (WordPress 5.0) and the Site Editor (WordPress 5.9), have upended the traditional way we build WordPress themes\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2022\/01\/wordpress-block-themes.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/373952"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/288717"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=373952"}],"version-history":[{"count":10,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/373952\/revisions"}],"predecessor-version":[{"id":376188,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/373952\/revisions\/376188"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/373964"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=373952"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=373952"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=373952"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}