{"id":8235,"date":"2019-04-29T08:19:07","date_gmt":"2019-04-29T08:19:07","guid":{"rendered":"https:\/\/ampforwp.com\/tutorials\/?post_type=ht_kb&#038;p=8235"},"modified":"2020-04-21T13:43:39","modified_gmt":"2020-04-21T13:43:39","slug":"how-to-use-amp_loop_image-2","status":"publish","type":"ht_kb","link":"https:\/\/ampforwp.com\/tutorials\/article\/how-to-use-amp_loop_image-2\/","title":{"rendered":"How to change Thumbnail size in the loop in AMP Theme Framework by using amp_loop_image"},"content":{"rendered":"\n<h3><strong>Description :<\/strong><\/h3>\n\n\n\n<p><strong>amp_loop_image<\/strong> is a function name in our AMP plugin by using this function we can display featured image in the loop on your homepage, archive pages, and related posts, etc.<\/p>\n\n\n\n<p>In the amp_loop_image function, we have only one parameter $args like amp_loop_image($args);. in which you need pass an array in the variable like below.<\/p>\n\n\n\n<h3 id=\"mce_14\">Source :<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">$args = array(\n                        'tag'='div',\n                        'tag_class'='image-container',\n                        'image_size'='full',\n                        'image_crop'='false',\n                        'image_crop_width'=$width,\n                        'image_crop_height'=$height,\n                        'responsive'= true\n                    );<\/pre>\n\n\n\n<h3 id=\"mce_32\">Parameters :<\/h3>\n\n\n\n<h4><strong>tag<\/strong><\/h4>\n\n\n\n<p>tag is the parameter in the array by using this tag we can set the tag name for example div,  section, and any other tag. in which &lt;a&gt; tag and &lt;amp-img&gt; tag will be wrapped inside that tag. <\/p>\n\n\n\n<h4><strong>tag_class<\/strong><\/h4>\n\n\n\n<p>tag_class is the parameter in the array by using this tag_class name we can give the class name for that tag.<\/p>\n\n\n\n<h4>image_size<\/h4>\n\n\n\n<p>image_size is the parameter in the array by using this image_size we can give the full, thumbnail and large, small image size.<\/p>\n\n\n\n<h4>image_crop<\/h4>\n\n\n\n<p>image_crop is the parameter in the array we can give the value like true or false <\/p>\n\n\n\n<h4>image_crop_width<\/h4>\n\n\n\n<p>image_crop_width is the parameter in the array we can give the width of the image.<\/p>\n\n\n\n<h4>image_crop_height<\/h4>\n\n\n\n<p>image_crop_height is the parameter in the array we can get the height of the image. <\/p>\n\n\n\n<h4>responsive<\/h4>\n\n\n\n<p>responsive is the parameter in the array we can give the value like true or false.  <\/p>\n\n\n\n<h2>Example :<\/h2>\n\n\n\n<p> <br>In the following example, If you want to edit the code of this function and load different size of images then you need to edit the width and height or if you want the default sizes of WP, then you can use the \u201cimage_size\u201d. <\/p>\n\n\n\n<p><strong>For Example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;pre>$width \t= 346;\n$height = 188;\n$args = array(\n\t        'tag'=&amp;gt;'div',\n\t\t'tag_class'=&amp;gt;'image-container',\n\t\t'image_size'=&amp;gt;'full',\n\t\t'image_crop'=&amp;gt;'false',\n\t\t'image_crop_width'=&amp;gt;$width,\n\t\t'image_crop_height'=&amp;gt;$height, \n\t\t'responsive'=&amp;gt; 'true'\n\t     ); \n\t\t&lt;div class=\"fsp-img\">\n\t          amp_loop_image($args);\n\t        &lt;\/div>&lt;\/pre><\/code><\/pre>\n\n\n\n<p><p style=\"background-color: #ffdddd; border-left: 2px solid #f44336;padding:10px;\"><strong> Note:<\/strong>\nIf you want to override loop images then use this function and override height, width, div, etc.<\/p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>That\u2019s it for this tutorial!<\/strong><\/p>\n\n\n\n<p>We hope it helped you. If you have any feedback or questions, then please share them in the comments section below.<\/p>\n<div id=\"div-1\" class=\"hkb-feedback\">\n\t\t\t<strong class=\"ht-mobile-exit__title\">Ask your Questions Directly!<\/strong><br>\n\t\t\t<div class=\"hkb_widget_exit__content\" style=\"font-size: 14px;\">If you can't find the solutions in this article, then just ask us in the comments and we will answer it for you!<\/div>\n\t\t\t<a href=\"https:\/\/ampforwp.com\/support\/#contact\" id=\"button\" target=\"_blank\" rel=\"noopener noreferrer\"><button>Yes, I have a Question<\/button><\/a>\n\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Description : amp_loop_image is a function name in our AMP plugin by using this function we can display featured image in the loop on your homepage, archive pages, and related posts, etc. In the amp_loop_image function, we have only one parameter $args like amp_loop_image($args);. in which you need pass an&#8230;<\/p>\n","protected":false},"author":18,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[81],"ht-kb-tag":[],"_links":{"self":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/8235"}],"collection":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/comments?post=8235"}],"version-history":[{"count":109,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/8235\/revisions"}],"predecessor-version":[{"id":17176,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb\/8235\/revisions\/17176"}],"wp:attachment":[{"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/media?parent=8235"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-category?post=8235"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/ampforwp.com\/tutorials\/wp-json\/wp\/v2\/ht-kb-tag?post=8235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}