{"id":1651873,"date":"2020-06-05T16:52:34","date_gmt":"2020-06-05T16:52:34","guid":{"rendered":"https:\/\/toolset.com\/?post_type=course-lesson&#038;p=1651873"},"modified":"2020-11-18T14:12:27","modified_gmt":"2020-11-18T14:12:27","slug":"creating-templates-to-display-members-only-content","status":"publish","type":"course-lesson","link":"https:\/\/toolset.com\/de\/course-lesson\/creating-templates-to-display-members-only-content\/","title":{"rendered":"Creating templates to display members-only content"},"content":{"rendered":"\n<p>Here&#8217;s an example of a membership site that offers video tutorials only to members.<\/p>\n\n\n\n<div class=\"wp-block-toolset-blocks-grid tb-grid\" data-toolset-blocks-grid=\"9cbc03461b87a40447ddc413b8a01dd9\">\n<div class=\"wp-block-toolset-blocks-grid-column tb-grid-column tb-grid-align-top\" data-toolset-blocks-grid-column=\"3034fbe886c11054e95b46b09d3e4112\">\n<p><strong>Logged-in members see<\/strong> <strong>full content<\/strong><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-toolset-blocks-grid-column tb-grid-column tb-grid-align-top\" data-toolset-blocks-grid-column=\"3034fbe886c11054e95b46b09d3e4112\">\n<p><strong>Visitors see<\/strong> <strong>only partial, teaser content<\/strong><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-toolset-blocks-grid-column tb-grid-column tb-grid-align-top\" data-toolset-blocks-grid-column=\"3034fbe886c11054e95b46b09d3e4112\">\n<figure class=\"wp-block-image tb-image tb-image-media img-border\" data-toolset-blocks-image=\"579c60ba3af3c3fe1c687e9e10b23c73\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content.jpg\"><img decoding=\"async\" width=\"1170\" height=\"860\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content.jpg\" alt=\"\" class=\"wp-image-1655039\" srcset=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content.jpg 1170w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content-300x221.jpg 300w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content-1024x753.jpg 1024w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content-150x110.jpg 150w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content-768x565.jpg 768w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-full-content-707x520.jpg 707w\" sizes=\"auto, (max-width: 1170px) 100vw, 1170px\" \/><\/a><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-toolset-blocks-grid-column tb-grid-column tb-grid-align-top\" data-toolset-blocks-grid-column=\"3034fbe886c11054e95b46b09d3e4112\">\n<figure class=\"wp-block-image tb-image tb-image-media img-border\" data-toolset-blocks-image=\"5162f54f666d396e877f10d72136228f\"><a href=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content.jpg\"><img decoding=\"async\" width=\"1170\" height=\"860\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content.jpg\" alt=\"\" class=\"wp-image-1655055\" srcset=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content.jpg 1170w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content-300x221.jpg 300w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content-1024x753.jpg 1024w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content-150x110.jpg 150w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content-768x565.jpg 768w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-membership-site-example-locked-content-707x520.jpg 707w\" sizes=\"auto, (max-width: 1170px) 100vw, 1170px\" \/><\/a><\/figure>\n\n\n\n<p><\/p>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Follow these steps<\/h2>\n\n\n\n<p>To create two templates, one for site members and one for visitors, you&#8217;ll need to install the <strong>Toolset Access<\/strong> plugin (in addition to Toolset Types and Toolset Blocks)<\/p>\n\n\n\n<p>Here is an outline of what you need to do:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Create two templates &#8211; a template for members with the full content and a template for visitors with teaser content<\/li><li>Use Toolset Access to set the template with a teaser to be displayed to visitors<\/li><li>Design the content of both templates<\/li><\/ol>\n\n\n\n<p>Let&#8217;s go through these steps one by one.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create the templates for logged-in users and for visitors<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>Go to&nbsp;<strong>Toolset&nbsp;<\/strong>\u2192&nbsp;<strong>Dashboard&nbsp;<\/strong>and click the&nbsp;<strong>Create Content Template<\/strong>&nbsp;button in the row of the post type you want to design a&nbsp;<a href=\"https:\/\/toolset.com\/glossary\/template\/\">template<\/a>&nbsp;for.<\/li><li>Go to the <strong>Toolset <\/strong>\u2192 <strong>Content Templates <\/strong>page and click the <strong>Add New <\/strong>button at the top.<\/li><li>Give a clear name to this template, something like &#8220;Teaser template for visitors&#8221;.<\/li><li>Don&#8217;t assign this template to any content and click to create it. <\/li><\/ol>\n\n\n\n<p>You can leave both templates mostly empty. We&#8217;ll get back to designing them in a minute.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Display the teaser template only to visitors<\/h3>\n\n\n\n<p>Now, let&#8217;s change the access settings so that visitors see only the teaser template when they visit our posts.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Go to <strong>Toolset <\/strong>\u2192 <strong>Access Control<\/strong>. All the post types in your site are listed here.<\/li><li>Click to expand the post type with your premium content. A table appears listing all user roles in your site and their permissions for this post type.<\/li><li>Under the <strong>Guest <\/strong>row, deselect the checkbox in the <strong>Read <\/strong>column. This means that visitors who are not logged in cannot view the default template for this content type.<\/li><li>Click the <strong>pen <\/strong>icon that appeared next to the checkbox you deselected. A pop-up dialog appears with options to select what to display for users with no read permission.<\/li><\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\" tb-image tb-image-media img-border aligncenter\" data-toolset-blocks-image=\"024cd9d8de283c5b46d006906c1e75ca\"><img decoding=\"async\" width=\"495\" height=\"517\" loading=\"lazy\" src=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-access-select-content-when-no-permission.jpg\" alt=\"\" class=\"wp-image-1652021\" srcset=\"https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-access-select-content-when-no-permission.jpg 495w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-access-select-content-when-no-permission-287x300.jpg 287w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-access-select-content-when-no-permission-144x150.jpg 144w, https:\/\/toolset.com\/wp-content\/uploads\/2020\/06\/toolset-access-select-content-when-no-permission-300x313.jpg 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><div class=\"tb-image-caption\"><figcaption>Pop-up dialog with options for when the user has no read permissions<\/figcaption><\/div><\/figure>\n<\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\"><li>In the first section, select the <strong>Show Content Template <\/strong>option. In the dropdown menu, select the teaser template you created.<\/li><li>In the second section, select the option to choose a different WordPress archive. In the dropdown menu, select the archive of your preference. This works the same as with templates. In our example, we display the same archive to all users. If needed, you could design a special &#8220;teaser archive&#8221;, just like for the templates.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Designing the templates<\/h2>\n\n\n\n<p>Now that we have two templates, it&#8217;s time to design them. The template for members will include the full content that you want site members to see.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>You can access both your templates from the <strong>Toolset <\/strong>\u2192 <strong>Content Templates <\/strong>page.<\/li><li>Edit them and use the WordPress Block Editor to design your template.<\/li><li>Choose blocks from the&nbsp;<strong>Toolset<\/strong>&nbsp;section for any part of the template that displays fields (not static elements). For example, use the <strong>Toolset Heading<\/strong> block for any heading that will display a field.<\/li><li>Enable&nbsp;<strong>Dynamic Sources<\/strong>&nbsp;for blocks that should display fields of the post that the template displays.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Template Design Tips<\/h3>\n\n\n\n<ul class=\"wp-block-list\"><li>Use the&nbsp;<strong>View with&nbsp;<\/strong>dropdown menu at the top of the editor to preview your template with any post of your choice.<\/li><li>Use the screen-size selector either at the top of the editor or next to different fields to design the template for different screen sizes.<\/li><li>Use the&nbsp;<strong>View<\/strong>&nbsp;block to display lists of related posts or repeating field groups.<\/li><\/ul>\n","protected":false},"author":4341,"featured_media":1652037,"template":"","related-lesson":[8427],"class_list":["post-1651873","course-lesson","type-course-lesson","status-publish","has-post-thumbnail","hentry","related-lesson-post-templates"],"_links":{"self":[{"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/course-lesson\/1651873","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/course-lesson"}],"about":[{"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/types\/course-lesson"}],"author":[{"embeddable":true,"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/users\/4341"}],"version-history":[{"count":2,"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/course-lesson\/1651873\/revisions"}],"predecessor-version":[{"id":1822085,"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/course-lesson\/1651873\/revisions\/1822085"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/media\/1652037"}],"wp:attachment":[{"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/media?parent=1651873"}],"wp:term":[{"taxonomy":"related-lesson","embeddable":true,"href":"https:\/\/toolset.com\/de\/wp-json\/wp\/v2\/related-lesson?post=1651873"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}