{"id":2859,"date":"2019-10-20T11:29:11","date_gmt":"2019-10-20T00:29:11","guid":{"rendered":"https:\/\/wpdevdesign.wpengine.com\/?p=2859"},"modified":"2020-10-09T13:46:53","modified_gmt":"2020-10-09T02:46:53","slug":"custom-easy-posts-layout-using-css-grid","status":"publish","type":"post","link":"https:\/\/wpdevdesign.com\/custom-easy-posts-layout-using-css-grid\/","title":{"rendered":"Custom Easy Posts Layout using CSS Grid"},"content":{"rendered":"<div class=\"mp_wrapper\">\n  <div class=\"mepr-unauthorized-excerpt\">\n    <p><em>Updated on October 09, 2020<\/em><\/p>\n<p>This <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/wpdevdesign.com\/membership\/\" target=\"_blank\">members-only<\/a> tutorial provides the steps to arrange posts output by <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/oxygenbuilder.com\" target=\"_blank\">Oxygen<\/a>'s Easy Posts component in a custom layout using CSS Grid's <a rel=\"noreferrer noopener\" aria-label=\"grid-template-areas (opens in a new tab)\" href=\"https:\/\/css-tricks.com\/snippets\/css\/complete-guide-grid\/#prop-grid-template-areas\" target=\"_blank\">grid-template-areas<\/a>.<\/p>\n<figure class=\"wp-block-image\"><img src=\"https:\/\/wpdevdesign.com\/wp-content\/uploads\/2019\/10\/oxygen-easy-posts-css-grid2-1024x536.jpg\" alt=\"\" class=\"wp-image-2861\" \/><\/figure>\n<p>Post categories (linking to their category archives) will be positioned near the top left of posts' featured images.<\/p>\n<p>The entire image will be set to be clickable to the post's permalink.<\/p>\n<figure class=\"wp-block-image\"><img src=\"https:\/\/wpdevdesign.com\/wp-content\/uploads\/2019\/10\/IMG_6644.jpg\" alt=\"\" class=\"wp-image-2860\" \/><\/figure>\n<p>From 767px and below, we shall set the posts to appear one below the other.<\/p>\n<h3 class=\"wp-block-heading\">Step 1<\/h3>\n<p>Since the maximum width taken up by the images for any given viewport is close to 800px (767px - 40px of padding = 727px to be exact), let's define a custom image size of say, 800px by 800px and display the images in this size.<\/p>\n<p>Install and activate <a rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\" href=\"https:\/\/wordpress.org\/plugins\/code-snippets\/\" target=\"_blank\">Code Snippets<\/a> plugin.<\/p>\n<p>Go to Snippets &gt; Add New.<\/p>\n<p>Title: <strong>Custom image sizes<\/strong><\/p>\n<p>Code:<\/p>\n<code>add_image_size( 'square-thumbnail', 800, 800, true );<\/code>\n<p><a rel=\"noreferrer noopener\" aria-label=\"Regenerate thumbnails (opens in a new tab)\" href=\"https:\/\/wordpress.org\/plugins\/regenerate-thumbnails\/\" target=\"_blank\">Regenerate thumbnails<\/a> if your posts already have featured images set.<\/p>\n<h3 class=\"wp-block-heading\">Step 2<\/h3>\n<p>Edit Page\/Template where you want to display the posts grid in Oxygen editor and add an Easy Posts component.<\/p>\n<p>In this example, we shall display the posts grid on a static Page.<\/p>\n<p>Go to Query and set the WP Query to <code>custom<\/code>.<\/p>\n<p>Select <code>post<\/code> Post Type and set Count to 5.<\/p>\n<p>Styles &gt; Responsive. Set \"Posts are 50% Width Below\" to Never.<\/p>\n<p>Go to Templates &gt; Template PHP. Replace all the code with<\/p>\n  <\/div>\n  <div class=\"mepr-unauthorized-message\">\n    <p>This is a premium members-only content.<\/p>\n<p>To view the rest of the content, please <a title=\"Membership\" href=\"https:\/\/wpdevdesign.com\/membership\/\">sign up for membership ($47\/month or $599 one-time)<\/a>.<\/p>\n<p>Already a member? Log in below or <a href=\"https:\/\/wpdevdesign.com\/login\/\">here<\/a>.<\/p>\n  <\/div>\n  <div class=\"mepr-login-form-wrap\">\n            \n<div class=\"mp_wrapper mp_login_form\">\n                  <!-- mp-login-form-start -->     <form name=\"mepr_loginform\" id=\"mepr_loginform\" class=\"mepr-form\" action=\"https:\/\/wpdevdesign.com\/login\/\" method=\"post\">\n            <div class=\"mp-form-row mepr_username\">\n        <div class=\"mp-form-label\">\n                              <label for=\"user_login\">Username<\/label>\n        <\/div>\n        <input type=\"text\" name=\"log\" id=\"user_login\" value=\"\" \/>\n      <\/div>\n      <div class=\"mp-form-row mepr_password\">\n        <div class=\"mp-form-label\">\n          <label for=\"user_pass\">Password<\/label>\n          <div class=\"mp-hide-pw\">\n            <input type=\"password\" name=\"pwd\" id=\"user_pass\" value=\"\" \/>\n            <button type=\"button\" class=\"button mp-hide-pw hide-if-no-js\" data-toggle=\"0\" aria-label=\"Show password\">\n              <span class=\"dashicons dashicons-visibility\" aria-hidden=\"true\"><\/span>\n            <\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n            <div>\n        <label><input name=\"rememberme\" type=\"checkbox\" id=\"rememberme\" value=\"forever\" \/> Remember Me<\/label>\n      <\/div>\n      <div class=\"mp-spacer\">&nbsp;<\/div>\n      <div class=\"submit\">\n        <input type=\"submit\" name=\"wp-submit\" id=\"wp-submit\" class=\"button-primary mepr-share-button \" value=\"Log In\" \/>\n        <input type=\"hidden\" name=\"redirect_to\" value=\"\/wp-json\/wp\/v2\/posts\/2859\" \/>\n        <input type=\"hidden\" name=\"mepr_process_login_form\" value=\"true\" \/>\n        <input type=\"hidden\" name=\"mepr_is_login_page\" value=\"false\" \/>\n      <\/div>\n    <\/form>\n    <div class=\"mp-spacer\">&nbsp;<\/div>\n    <div class=\"mepr-login-actions\">\n        <a\n          href=\"https:\/\/wpdevdesign.com\/login\/?action=forgot_password\"\n          title=\"Click here to reset your password\"\n        >\n          Forgot Password        <\/a>\n    <\/div>\n\n      \n    <!-- mp-login-form-end --> \n  <\/div>\n      <\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Updated on October 09, 2020 This members-only tutorial provides the steps to arrange posts output by Oxygen&#8217;s Easy Posts component in a custom layout using CSS Grid&#8217;s grid-template-areas. Post categories (linking to their category archives) will be positioned near the top left of posts&#8217; featured images. The entire image will be set to be clickable &hellip;<\/p>\n","protected":false},"author":1,"featured_media":2861,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"footnotes":""},"categories":[64,52],"tags":[41,51],"class_list":["post-2859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oxygen","category-premium","tag-css-grid","tag-easy-posts"],"acf":[],"featured_image_src":"https:\/\/wpdevdesign.com\/wp-content\/uploads\/2019\/10\/oxygen-easy-posts-css-grid2.jpg","featured_image_src_square":"https:\/\/wpdevdesign.com\/wp-content\/uploads\/2019\/10\/oxygen-easy-posts-css-grid2.jpg","author_info":{"display_name":"Sridhar Katakam","author_link":"https:\/\/wpdevdesign.com\/author\/srikat\/"},"_links":{"self":[{"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/posts\/2859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/comments?post=2859"}],"version-history":[{"count":0,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/posts\/2859\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/media\/2861"}],"wp:attachment":[{"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/media?parent=2859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/categories?post=2859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wpdevdesign.com\/wp-json\/wp\/v2\/tags?post=2859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}