{"id":6209,"date":"2017-01-28T16:53:44","date_gmt":"2017-01-28T21:53:44","guid":{"rendered":"https:\/\/themespress.ca\/?p=6209"},"modified":"2022-09-03T13:58:21","modified_gmt":"2022-09-03T17:58:21","slug":"display-images-linked-to-wordpress-post-id","status":"publish","type":"post","link":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/","title":{"rendered":"Display Images linked to WordPress Post ID"},"content":{"rendered":"<div class=\"wpb-content-wrapper\"><div class=\"vc_row wpb_row vc_row-fluid\"><div class=\"wpb_column vc_column_container vc_col-sm-12\"><div class=\"vc_column-inner\"><div class=\"wpb_wrapper\">\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>With this tutorial, we will create a function that will display images linked to Post IDs.<\/p>\n<p>Let&#8217;s say you have a form, you add a post and upload multiple images. These images are now known as  get_attachment_image.<\/p>\n<p>With this function we will use a query that will fetch the Post IDs&#8217; get_attachment_image. We also want to display the image with the $size = medium;.<\/p>\n<p>As reference, here are the image sizes that WordPress uses: thumbnail, medium, large, and full.<\/p>\n<p>We also need to specify in our function that if there aren&#8217;t any images linked to the a post ID, to display noting. We configure our arguments and display nothing if empty.<\/p>\n<p>Now we will loop our results with a foreach with custom HTML.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-8361257\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-8361257\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">function via_get_images_attachees() {\n\tglobal $post;\n    $thumb_id = get_post_thumbnail_id($post-&gt;ID);\n\t$id = intval( $post-&gt;ID );\n\t$size = &#039;medium&#039;;\n\t$attachments = get_children( array(\n\t\t\t&#039;post_parent&#039;     =&gt; $id,\n\t\t\t&#039;post_status&#039;     =&gt; &#039;inherit&#039;,\n\t\t\t&#039;post_type&#039;       =&gt; &#039;attachment&#039;,\n\t\t\t&#039;post_mime_type&#039;  =&gt; &#039;image&#039;,\n\t\t\t&#039;order&#039;           =&gt; &#039;ASC&#039;,\n\t\t\t&#039;orderby&#039;         =&gt; &#039;menu_order&#039;,\n            &#039;post__not_in&#039;    =&gt; array( $thumb_id )\n\t\t) );\n\tif ( empty( $attachments ) )\n\treturn &#039;&#039;;\n\t$output = &quot;\\n&quot;;\n\t$output .= &#039;&lt;div id=&quot;grid&quot;&gt;&#039;; \n    \n\t\/*** Loop through each attachment ***\/ \n\tforeach ( $attachments as $id =&gt; $attachment ) : $img_cap = $attachment-&gt;post_excerpt; \n\t\t\/\/ New line to get the caption \n\t\t$img_alt = get_post_meta($attachment_id, &#039;_wp_attachment_image_alt&#039;, true); \n\t\t\/\/alt \n\t\tif ($img_alt == &#039;&#039;) : \n\t\t$img_alt = $attachment-&amp;gt;post_title; endif; $title = esc_html( $attachment-&amp;gt;post_title, 1 ); \n\t\t$img = wp_get_attachment_image_src( $id, $size ); \n\t\t$output .= &#039;&lt;div class=&quot;box&quot;&gt;&#039;; \n\t\t$output .= &#039;&lt;div data-thumbnail=&quot;&#039; . esc_url( wp_get_attachment_url( $id ) ) . &#039;&quot;&gt;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div data-image=&quot;&#039; . esc_url( wp_get_attachment_url( $id ) ) . &#039;&quot;&gt;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div class=&quot;thumbnail-caption&quot;&gt;&#039;; \n\t\t$output .= &#039;&lt;h3&gt;&#039;. $img_alt .&#039;&lt;\/h3&gt;&#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div class=&quot;lightbox-text&quot;&gt;&#039;; \n\t\t$output .= &#039;&quot; &#039;. $img_alt .&#039; &quot; &#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\tendforeach; \n\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\n\treturn $output; \n}<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>Please note that in the loop, we also want to store the image&#8217;s lat text in the <strong>$img_alt<\/strong> variable. Whether it&#8217;s a good or bad idea is up to you.<\/p>\n<p>Now let&#8217;s display the results within a template::<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-4996646\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-4996646\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"standard\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">&lt;?php echo via_get_images_attachees(); ?&gt;<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>We know that the Post Thumbnail is considered like an attached image. So the Post Thumbnail will be in the list of images. You can add an exclusion in your arguments with the <strong>$thumb_id<\/strong> variable.<\/p>\n<p>Here&#8217;s an example of how to exclude the Post Thumbnail: Use the following argument after the $post;<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-3776358\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-3776358\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"standard\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">$thumb_id = get_post_thumbnail_id($post-&gt;ID);<\/pre><\/div>\n\t<div class=\"wpb_text_column wpb_content_element\" >\n\t\t<div class=\"wpb_wrapper\">\n\t\t\t<p>And then we add the excluded argument in the $attachments variable by using post__not_in  inside the <strong>$thumb_id<\/strong> variable.<\/p>\n\n\t\t<\/div>\n\t<\/div>\n<div id=\"ts-enlighterjs-container-5771878\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-5771878\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"standard\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">$attachments = get_children( array(\n\t&#039;post_parent&#039;    =&gt; $id,\n\t&#039;post_status&#039;    =&gt; &#039;inherit&#039;,\n\t&#039;post_type&#039;      =&gt; &#039;attachment&#039;,\n\t&#039;post_mime_type&#039; =&gt; &#039;image&#039;,\n\t&#039;order&#039;          =&gt; &#039;ASC&#039;,\n\t&#039;orderby&#039;        =&gt; &#039;menu_order&#039;,\n\t&#039;post__not_in&#039;   =&gt; array( $thumb_id )\n) );<\/pre><\/div><h2 style=\"text-align: left\" class=\"vc_custom_heading vc_do_custom_heading\" >Final code snippet to display images attached to WordPress Post IDs by excluding Post Thumbnail<\/h2><div id=\"ts-enlighterjs-container-7543420\" class=\"ts-enlighterjs-container-single-enabled  \" style=\"width: 100%;  margin-top: 0px; margin-bottom: 0px;\" data-enlighter-doubleclick=\"true\" data-enlighter-windowbutton=\"true\" data-enlighter-windowtext=\"New Window\" data-enlighter-rawbutton=\"true\" data-enlighter-rawtext=\"RAW Code\" data-enlighter-infobutton=\"false\" data-enlighter-infotext=\"EnlighterJS\" data-enlighter-indent=\"2\"><pre id=\"ts-enlighterjs-pre-7543420\" class=\"\" style=\"white-space: pre-wrap; height: 100%; margin: 0; padding: 0;\" data-enlighter-language=\"php\" data-enlighter-theme=\"enlighter\" data-enlighter-group=\"\" data-enlighter-title=\"\" data-enlighter-linenumbers=\"true\" data-enlighter-lineoffset=\"1\" data-enlighter-highlight=\"\">function via_get_images_attachees() {\n\tglobal $post;\n    $thumb_id = get_post_thumbnail_id($post-&gt;ID);\n\t$id = intval( $post-&gt;ID );\n\t$size = &#039;medium&#039;;\n\t$attachments = get_children( array(\n\t\t\t&#039;post_parent&#039;     =&gt; $id,\n\t\t\t&#039;post_status&#039;     =&gt; &#039;inherit&#039;,\n\t\t\t&#039;post_type&#039;       =&gt; &#039;attachment&#039;,\n\t\t\t&#039;post_mime_type&#039;  =&gt; &#039;image&#039;,\n\t\t\t&#039;order&#039;           =&gt; &#039;ASC&#039;,\n\t\t\t&#039;orderby&#039;         =&gt; &#039;menu_order&#039;,\n            &#039;post__not_in&#039;    =&gt; array( $thumb_id )\n\t\t) );\n\tif ( empty( $attachments ) )\n\treturn &#039;&#039;;\n\t$output = &quot;\\n&quot;;\n\t$output .= &#039;&lt;div id=&quot;grid&quot;&gt;&#039;; \n    \n\t\/*** Loop through each attachment ***\/ \n\tforeach ( $attachments as $id =&gt; $attachment ) : $img_cap = $attachment-&gt;post_excerpt; \n\t\t\/\/ New line to get the caption \n\t\t$img_alt = get_post_meta($attachment_id, &#039;_wp_attachment_image_alt&#039;, true); \n\t\t\/\/alt \n\t\tif ($img_alt == &#039;&#039;) : \n\t\t$img_alt = $attachment-&amp;gt;post_title; endif; $title = esc_html( $attachment-&amp;gt;post_title, 1 ); \n\t\t$img = wp_get_attachment_image_src( $id, $size ); \n\t\t$output .= &#039;&lt;div class=&quot;box&quot;&gt;&#039;; \n\t\t$output .= &#039;&lt;div data-thumbnail=&quot;&#039; . esc_url( wp_get_attachment_url( $id ) ) . &#039;&quot;&gt;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div data-image=&quot;&#039; . esc_url( wp_get_attachment_url( $id ) ) . &#039;&quot;&gt;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div class=&quot;thumbnail-caption&quot;&gt;&#039;; \n\t\t$output .= &#039;&lt;h3&gt;&#039;. $img_alt .&#039;&lt;\/h3&gt;&#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;div class=&quot;lightbox-text&quot;&gt;&#039;; \n\t\t$output .= &#039;&quot; &#039;. $img_alt .&#039; &quot; &#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\t$output .= &#039;&lt;\/div&gt;&#039;; \n\tendforeach; \n\t$output .= &#039;&lt;\/div&gt;&#039;; \n\t\n\treturn $output; \n}<\/pre><\/div><\/div><\/div><\/div><\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"With this tutorial, we will create a function that will display images linked to Post IDs. Let's say you have a form, you add a post and upload multiple images.<div class=\"read-more\"><a class=\"btn button-secondary\" href=\"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/\">Read More<\/a><\/div>","protected":false},"author":81,"featured_media":4587,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[283],"tags":[356],"class_list":["post-6209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-using-images"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Share the post &quot;Display Images linked to WordPress Post ID&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Daniel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Themespress - Des tutoriels et ressources WordPress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Display Images linked to WordPress Post ID - Themespress\" \/>\n\t\t<meta property=\"og:description\" content=\"Share the post &quot;Display Images linked to WordPress Post ID&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2017-01-28T21:53:44-05:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2022-09-03T17:58:21-04:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Display Images linked to WordPress Post ID - Themespress\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Share the post &quot;Display Images linked to WordPress Post ID&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#blogposting\",\"name\":\"Display Images linked to WordPress Post ID - Themespress\",\"headline\":\"Display Images linked to WordPress Post ID\",\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/wsi-imageoptim-Afficher-les-images-attach\\u00e9es-Post-ID-WordPress.jpg\",\"width\":940,\"height\":393},\"datePublished\":\"2017-01-28T16:53:44-05:00\",\"dateModified\":\"2022-09-03T13:58:21-04:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#webpage\"},\"articleSection\":\"Tutorials, Images\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"position\":2,\"name\":\"Tutorials\",\"item\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#listItem\",\"name\":\"Display Images linked to WordPress Post ID\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#listItem\",\"name\":\"Accueil\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#listItem\",\"position\":3,\"name\":\"Display Images linked to WordPress Post ID\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/categorie\\\/tutorials\\\/#listItem\",\"name\":\"Tutorials\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/\",\"name\":\"Daniel\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Daniel\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#webpage\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/\",\"name\":\"Display Images linked to WordPress Post ID - Themespress\",\"description\":\"Share the post \\\"Display Images linked to WordPress Post ID\\\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\\u2019s say you have a form, you add a post and upload multiple images. These images are now known as\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/author\\\/daniel\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/themespress.ca\\\/wp-content\\\/uploads\\\/2017\\\/02\\\/wsi-imageoptim-Afficher-les-images-attach\\u00e9es-Post-ID-WordPress.jpg\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#mainImage\",\"width\":940,\"height\":393},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/display-images-linked-to-wordpress-post-id\\\/#mainImage\"},\"datePublished\":\"2017-01-28T16:53:44-05:00\",\"dateModified\":\"2022-09-03T13:58:21-04:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/themespress.ca\\\/en\\\/\",\"name\":\"Themespress\",\"description\":\"Des tutoriels et ressources WordPress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/themespress.ca\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Display Images linked to WordPress Post ID - Themespress","description":"Share the post \"Display Images linked to WordPress Post ID\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as","canonical_url":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#blogposting","name":"Display Images linked to WordPress Post ID - Themespress","headline":"Display Images linked to WordPress Post ID","author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2017\/02\/wsi-imageoptim-Afficher-les-images-attach\u00e9es-Post-ID-WordPress.jpg","width":940,"height":393},"datePublished":"2017-01-28T16:53:44-05:00","dateModified":"2022-09-03T13:58:21-04:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#webpage"},"isPartOf":{"@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#webpage"},"articleSection":"Tutorials, Images"},{"@type":"BreadcrumbList","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","position":1,"name":"Accueil","item":"https:\/\/themespress.ca\/en\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","position":2,"name":"Tutorials","item":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/","nextItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#listItem","name":"Display Images linked to WordPress Post ID"},"previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/#listItem","name":"Accueil"}},{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#listItem","position":3,"name":"Display Images linked to WordPress Post ID","previousItem":{"@type":"ListItem","@id":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/#listItem","name":"Tutorials"}}]},{"@type":"Organization","@id":"https:\/\/themespress.ca\/en\/#organization","name":"Themespress","description":"Des tutoriels et ressources WordPress","url":"https:\/\/themespress.ca\/en\/"},{"@type":"Person","@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author","url":"https:\/\/themespress.ca\/en\/author\/daniel\/","name":"Daniel","image":{"@type":"ImageObject","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/93cd2188e40b3289d305e88acb676eb8b84078e50e06f4eb38a0152903b34c9d?s=96&d=mm&r=g","width":96,"height":96,"caption":"Daniel"}},{"@type":"WebPage","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#webpage","url":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/","name":"Display Images linked to WordPress Post ID - Themespress","description":"Share the post \"Display Images linked to WordPress Post ID\" Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/themespress.ca\/en\/#website"},"breadcrumb":{"@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#breadcrumblist"},"author":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"creator":{"@id":"https:\/\/themespress.ca\/en\/author\/daniel\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/themespress.ca\/wp-content\/uploads\/2017\/02\/wsi-imageoptim-Afficher-les-images-attach\u00e9es-Post-ID-WordPress.jpg","@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#mainImage","width":940,"height":393},"primaryImageOfPage":{"@id":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/#mainImage"},"datePublished":"2017-01-28T16:53:44-05:00","dateModified":"2022-09-03T13:58:21-04:00"},{"@type":"WebSite","@id":"https:\/\/themespress.ca\/en\/#website","url":"https:\/\/themespress.ca\/en\/","name":"Themespress","description":"Des tutoriels et ressources WordPress","inLanguage":"en-US","publisher":{"@id":"https:\/\/themespress.ca\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Themespress - Des tutoriels et ressources WordPress","og:type":"article","og:title":"Display Images linked to WordPress Post ID - Themespress","og:description":"Share the post &quot;Display Images linked to WordPress Post ID&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as","og:url":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/","article:published_time":"2017-01-28T21:53:44-05:00","article:modified_time":"2022-09-03T17:58:21-04:00","twitter:card":"summary","twitter:title":"Display Images linked to WordPress Post ID - Themespress","twitter:description":"Share the post &quot;Display Images linked to WordPress Post ID&quot; Facebook LinkedIn Twitter Partager... E-mail Ajouter aux favoris Bluesky With this tutorial, we will create a function that will display images linked to Post IDs. Let\u2019s say you have a form, you add a post and upload multiple images. These images are now known as"},"aioseo_meta_data":{"post_id":"6209","title":null,"description":null,"keywords":[],"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":[],"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[],"defaultGraph":"Article","defaultPostTypeGraph":""},"schema_type":"default","schema_type_options":"{\"article\":{\"articleType\":\"BlogPosting\"},\"course\":{\"name\":\"\",\"description\":\"\",\"provider\":\"\"},\"faq\":{\"pages\":[]},\"product\":{\"reviews\":[]},\"recipe\":{\"ingredients\":[],\"instructions\":[],\"keywords\":[]},\"software\":{\"reviews\":[],\"operatingSystems\":[]},\"webPage\":{\"webPageType\":\"WebPage\"},\"blockGraphs\":[]}","pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2022-09-03 17:47:44","updated":"2025-06-08 01:54:06","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/\" title=\"Accueil\">Accueil<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/themespress.ca\/en\/categorie\/tutorials\/\" title=\"Tutorials\">Tutorials<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDisplay Images linked to WordPress Post ID\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Accueil","link":"https:\/\/themespress.ca\/en\/"},{"label":"Tutorials","link":"https:\/\/themespress.ca\/en\/categorie\/tutorials\/"},{"label":"Display Images linked to WordPress Post ID","link":"https:\/\/themespress.ca\/en\/display-images-linked-to-wordpress-post-id\/"}],"_links":{"self":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/users\/81"}],"replies":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/comments?post=6209"}],"version-history":[{"count":0,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/posts\/6209\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media\/4587"}],"wp:attachment":[{"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/media?parent=6209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/categories?post=6209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/themespress.ca\/en\/wp-json\/wp\/v2\/tags?post=6209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}