EDITS.WS

Tag: Conditional Logic

  • How to Show Divi’s Comments Module to Logged-In Users Only

    The comments section of any blog can be a place of great discussion. However, there may come a time when you want to build your community online. With the Divi Condition Options feature, we can prevent users not part of your blog from commenting on posts. This could work for a members-only community or as a perk of a membership site.

    In this tutorial, we’ll show you how to display Divi’s Comments Module to logged-in users only, this will allow you to directly interact with your community! We’ll use the Film Lab Blog Post Template for the base of this Divi tutorial.

    How to Create a Members-Only Comment Section

    Divi’s Condition feature allows us to choose a set of parameters with which modules, rows, columns, and sections can interact. For our case, we’ll want to set the display conditions based on a user’s logged-in status. Here’s a summary of the steps we’ll take in this tutorial to achieve our members-only comment section:

    1. Upload your blog post template to the Divi Theme Builder (or create your blog template!)
    2. Create your members-only comment section containing a Login Module
    3. Activate Display Conditions for the row containing the Login Module
    4. Activate Display Conditions for the row containing the Comment Module
    5. Save and test the template in an incognito window

    Before: A Free-for-All All Comment Section

    This is what the Film Lab Blog Post Template looks like without the members-only comment section. Notice that anyone can land on a blog post, read it, and interact with the comments section.

    How to show Divi's Comments Module to logged in users only, after login

    After: A Members Only Comment Section

    Using Divi’s Condition Options, we can now show a Login Module. Once a user has logged in, they can interact with the Comment Module. If they are not a logged-in user, they cannot see or submit a comment.

    How to show Divi's Comments Module to logged in users only, before login

    Installing the Blog Post Template

    Before we start creating our members-only comment section, we need to download the template we’ll use. You can download the Film Lab Blog Post Template here.

    Download the Film Lab Blog Post Template from the Divi blog

    Go to Divi Theme Builder

    To upload the template, navigate to the Divi Theme Builder in the backend of your WordPress website.

    Getting started with the Divi Conference Layout Pack

    Upload Website Template

    Then, in the top right corner, you’ll see an icon with two arrows. Click on the icon.

    Importing the Header and Footer Layout into the Divi Theme Buidler

    Navigate to the import tab, upload the JSON file you could download in this post, and click ‘Import Divi Theme Builder Templates.’

    Import settings for the header and footer layout pack

    Save Divi Theme Builder Changes

    Once you’ve uploaded the file, you’ll notice a new template with a new body area assigned to All Posts. Save the Divi Theme Builder changes as soon as you want the template activated.

    Save the imported blog post layout within the Divi Theme Builder

    Modifying The Template

    Open Post Template

    Now that our template is installed and assigned to all the blog posts on our site, we can begin building our members-only comment section. We start by opening the template.

    Begin editing the blog post body template within the Divi Builder

    Add a New Row for the Login Module

    Add a new row within the same section as the Comment Module of this template. Switch to wireframe view to make it easier. Then, click the green plus icon to add a new row above the row containing the Comment Module.

    Add new for for Login Module

    Next, we’re going to add one column to the row.

    Add a one column layout to the newly added row

    Add Login Module

    In our new row, we’re going to add a Login Module. We want users to log in to our website to access our members-only comment section. Scroll through the Module modal box till you see the

    Add login module as we start to create our members only comment section

    Add Text to Login Module

    Let’s add a title to the Login Module. We’ll also use this title to ask users to log in before accessing our comments section.

    Add title to Login Module

    Style Login Module

    Now, we will style our newly added Login Module to match the branding of the Film Lab Blog Template.

    Setting the Background of the Login Module

    Click on the paint bucket icon. This will add a solid fill color of #ff4125 to the module’s background. Next, click on the Use Background Color toggle.

    Add background color to Login Module for our members only comment section

    Background

    • Background Color: #ff4125
    • Use Background Color: Yes

    Styling the Fields

    For the Fields, we will use the same color as the section for its background with black text.

    Start styling the fields of the Login Module

    Fields: Background and Text Styling

    • Fields Background Color: #eae9e4
    • Fields Text Color: #000000
    • Fields Focus Background Color: #eae9e4
    • Fields Focus Text Color: #000000

    We will also give the fields a border and no rounded corners. This will imitate the styling of the Comment Module.

    Login fields border styling

    Fields: Background and Text Styling

    • Fields Rounded Corners: 0
    • Fields Border Styles: All
    • Fields Border Width: 1px
    • Fields Border Color: #000000
    • Fields Border Style: Solid

    Styling the Title

    The title will use the same font used throughout the template and will be white.

    Styling the title text of the Login Module

    Title Text

    • Title Heading Text: H2
    • Title Font: Mulish
    • Title Text Color: #ffffff

    Notice that we add responsive sizes for the title to look good on different screen sizes.

    Setting the title text font sizes for the Login Module

    Title Text: Font Size

    • Title Text Font Size (Desktop): 64px
    • Title Text Font Size (Tablet): 48px
    • Title Text Font Size (Mobiler): 48px

    Styling the Button

    To save time, copy and paste the button settings from the Comment Module to our Login Module. Click on the settings icon for the Comment Module.

    Copying the button settings from the comment module

    Navigate to the Design tab. Scroll down to the Button tab. Right-click on the button tab and click Copy Button Styles.

    Copying the button settings -again -from the comment module

    Afterward, exit the Comment Module. Enter the Login Module by clicking on the gear icon.

    Enter Login Module settings

    Again, click the Design tab and scroll down to the Button tab. Next, right-click and select Paste Button Styles. Voila! The button looks close to the button within the Comment Module.

    Paste Button Styles from Comment Module to Login Module

    Now, our Login Module’s button closely matches the styling of the Comment Module buttons. Yay us!

    Login module Button styling

    Apply Display Condition to Login Module Row

    With our Login Module styled, we can now put our first Display Condition into place. The Display Condition is critical for creating a members-only comment section. Divi provides various options within the Display Condition feature that help make this possible. Click on the gear icon to enter the settings for the row containing the Login Module.

    Enter the row settings for the row with the Login Module

    Click on the Advanced tab within the row settings, then click the Conditions tab. Then, click on the plus icon.

    Preparing to activate the Display Conditions for our members only comment section

    When you click on the plus icon, you’ll have many options for what condition you’ll display (or hide) this row. Scroll down to User Status, and then click Logged In Status.

    Activating logged in status display condition for the Login Module row

    Once that is done, we’ll receive another modal box. Within this modal box, we want to click on the dropdown that says, User is Logged In and change that to User is Logged Out. This is what contributes to our members-only comment section. As we want people to be site members, they must have a valid login credential to access our comments section. If they don’t have valid credentials, they can’t access the comment section of our site.

    Display this row only if the user is logged out

    Display Conditions

    • Display Only If: User is Logged Out
    • Enable Condition: Yes

    Once you’ve selected your Display Condition, ensure that you save your changes by clicking on the green check button of the modal box. Be aware of the notification regarding caching plugins.

    Save display conditions settings in preparation for our members only comment section

    Activating Display Conditions for the New Members Only Comment Section

    The final piece of this tutorial is setting up the Display Condition for the row containing the Comment Module. To do this, click the gear icon to access the row settings.

    Editing the row containing the Comment Module to create our members only comment section

    Like the row containing the Login Module, once inside the Row Settings, we’ll click on the Advanced tab, then click the Conditions tab and press the plus icon to add our Display Condition.

    Activating the Display Condition for the Comment Module row

    For the row containing the Comment Module, instead of displaying only if the user is logged out, we want it to display only if the user is logged in.

    Display Conditions for the row containing the Comments Module for our members only comment section

    A Finished Members Only Comment Section

    Now that we’ve added Display Conditions to both the Comment Module and the row with the Login Module, we can do a quick test. Visit a blog post on your site in an incognito or private browsing window.

    Our members only comment section in a private browser

    We use a private browser or incognito window to test our display conditions because the window will temporarily log us out of our website while browsing within it. When you go back to regular browsing and you *are* logged into your website, you should see your comment section. Alternatively, you can log out of your WordPress website to see your finished work! While we did this tutorial on a Comment Module, this can be applied to any module, row, column, or section natively within Divi; no additional plugin is needed. Take some time to mix and match the different display settings and see what you make.

    In Conclusion

    Creating a community on your WordPress website allows you to deepen the trust of those who use your website the most. A way to do this is by creating a members-only comments section that allows members to interact with each other easily. Divi has built-in tools and features that make doing this a breeze. With Divi’s native Display Conditions, allowing your users to only interact with each other is possible. Furthermore, you can easily style your Comments Module using the Design tab and Divi’s complete editing tools. To build an agile private community, you don’t need to install a membership plugin when you use Divi. By activating certain features in Divi’s core, you can create a logged-in user comment section, strengthen your online community, and keep your WordPress website light and agile. Before reaching for a plugin to add simple membership features to your website, consider checking out Divi’s Display Conditions for aspects of your website today.

    The post How to Show Divi’s Comments Module to Logged-In Users Only appeared first on Elegant Themes Blog.

  • 9 Best WordPress Conditional Logic Plugins for 2023

    Are you looking for the best conditional logic plugins for your WordPress website?

    Conditional logic plugins allow you to show or hide information based on users’ responses and behavior. They help collect relevant leads, boost conversions, and provide a better user experience.

    In this article, we will show you the best WordPress conditional logic plugins.

    Best WordPress conditional logic plugins

    What is Conditional Logic in WordPress?

    In simple words, you can think of conditional logic as if-then statements. It is a technique where you can automatically display relevant information, snippets, or scripts to users based on their actions.

    For instance, a user may want to connect with the support team. If they select a support team as an option on your WordPress site, then you can show relevant contact information or a landing page.

    Similarly, let’s say a customer is looking for hiking shoes. You can use conditional logic to only show those products and addons that a customer is looking for.

    Where Can You Use WordPress Conditional Logic Plugins?

    You’ll find conditional logic in WordPress forms, automated email workflows, conversion optimization methods, and more.

    Here are some ways you can use conditional logic on your WordPress website:

    • Use conditional logic on your WordPress forms and dynamically change form fields based on the selection users make while filling out your forms.
    • Create optin campaigns and show popups based on different rules, like the user spending a certain time on the page or clicking a link.
    • Load code snippets and scripts based on conditional logic and user roles.
    • Ask different questions in online quizzes based on the user’s previous answers.
    • Display or hide products, addons, and other items based on customer choices on your eCommerce store.
    • Set up visibility rules using conditional logic to show menu items for your visitors.

    That said, let’s see the best WordPress conditional logic plugins you can use today for your website.

    1. WPCode

    WPCode - Best WordPress Code Snippets Plugin

    WPCode is the best WordPress code snippet plugin. You easily add custom code snippets to your website and manage them using the plugin.

    The best part, WPCode offers a conditional logic feature that lets you set up rules for running code snippets without editing code. It is super easy to use and offers a beginner-friendly interface.

    For example, you can load code snippets for logged-in users, run PHP code snippets for specific user roles and page URLs, and insert header and footer pixel scripts for certain pages.

    WPCode Smart Conditional Logic

    You can also hide custom code from running on pages like the homepage or for different user roles.

    2. Conditional Blocks

    Conditional blocks

    Conditional Blocks is a free WordPress plugin for hiding or showing different blocks in the content editor. You can control the visibility of each block without writing a single line of code.

    The plugins let you set up conditions where WordPress blocks will appear for different user roles or membership levels. For instance, you can show the image block to only logged-in users. It also allows you to show certain blocks based on screen size.

    Conditional Blocks offers a premium version as well. You get to unlock more conditions for showing WordPress blocks. For example, you can control block visibility based on post type, time, server requests, and more. There are also conditions for WooCommerce users in the pro version.

    3. WPForms

    WPForms

    WPForms is the best contact form plugin for WordPress. It is beginner friendly plugin that offers a drag-and-drop form builder, lots of templates, and a smart conditional logic feature.

    You can easily hide or show different form fields, display payment options, dropdown menus, and more based on the user’s responses.

    All you need to do is select the form field in the template and enable conditional logic. After that, you can set up the rules to show different form fields.

    For example, let’s say you’re running a net promoter score (NPS) survey on your website. If a user rates 8 or higher, then you can hide other questions in the survey using conditional logic. If they rate a lower score, then you can ask more questions to improve your performance.

    Enter conditional logic conditions

    Besides that, WPForms offers lots of other features and addons. You can integrate different payment services and create forms to collect online payments.

    It also works with some of the most popular email marketing tools, so you can easily collect leads and grow your email list.

    Other than that, there are addons for recovering form abandonment, tracking user journeys, adding save and resume features, learning about the user’s geolocation data, and more.

    4. OptinMonster

    The OptinMonster lead generation tool

    OptinMonster is the best WordPress popup and lead generation plugin. It helps you get more conversions, grow your email list, and increase sales.

    OptinMonster offers powerful display rules that you can use to display your campaigns to the right people at the right time.

    For example, you can show optin popups to users that spend a certain time on a page, visit a particular page, or scroll X% of the page.

    OptinMonster also offers an Exit-Intent technology, which triggers your campaigns as a user is about to leave your website. This helps recover abandoning visitors and converts them into subscribers and customers.

    Enter exact URL for exit intent display rule

    Other than that, you can display campaigns to users from a particular location or when they click a link. There are also display rules for eCommerce sites. You can show popups when customers have a specific cart total or when they view a product.

    OptinMonster also offers a drag-and-drop builder, which makes it very easy to create attractive campaigns. There are lots of templates for different types of campaigns and various customization options. You can also integrate it with leading email marketing tools to collect leads.

    5. YITH WooCommerce Product Add-Ons & Extra Options

    YITH WooCommerce product addons and extra options

    YITH WooCommerce Product Add-Ons & Extra Options is a WooCommerce plugin that lets you add extra options and addons to your products.

    The plugin is very easy to use and allows you to add options and extra services, like warranty, insurance, special transfer services, express shipping, customizations, and more.

    For example, if you’re selling jewelry and rings, then you can add an option to engrave the customer’s name. Or if you’re selling tech products in WooCommerce, then you can offer additional services like warranty, product customization, and device checkup.

    With YITH WooCommerce Product Add-Ons & Extra Options, you get a conditional logic feature that automatically shows or hides addons and options based on the customer’s selection.

    You can define rules, and when the conditions are met, users will be able to see extra services and addons on your WooCommerce products.

    6. Thrive Quiz Builder

    Thrive Quizzes

    Thrive Quiz Builder is the best WordPress quiz plugin and is part of Thrive Theme suite. It is beginner friendly to use, and you can create complex quizzes for your website without editing code.

    The plugin offers different quiz styles, which include a right/wrong, number, percentage, personality, and survey. Thrive Quiz Builder also provides pre-made quiz templates that you can use to get started quickly.

    Using the plugin, you can create conditional quizzes. The drag-and-drop quiz builder lets you display questions based on the user’s previous answers. Simply set the conditions where the next question will only appear if a person enters a particular answer.

    When they’re finished, you can direct them to a page or product based on their answers.

    Besides that, you can create badges for users, customize the quizzes, track results, check the quiz flow and see where users dropped off, and get detailed analytics of how your quizzes perform.

    7. Formidable Forms

    The Formidable Forms plugin and Signature addon

    Formidable Forms is the next WordPress conditional logic plugin on our list. The plugin allows you to create simple contact forms to advanced and complex WordPress forms, like mortgage calculators.

    Formidable Forms offers a conditional logic feature built into its drag-and-drop form builder. You can easily set up conditions for each form field and show or hide them based on the user’s answers.

    If you have a multi-step form, then you can use conditional logic to automatically skip pages and lead users to the relevant section. Similarly, you can send email confirmation or redirect users to respective pages based on their answers.

    Other features offered by Formidable Forms include pre-built templates for web applications. It also lets you create apps for real estate listings, product reviews, restaurant menus, and more.

    The plugin also has a visual views feature that allows you to display data from form entries on the frontend of your site.

    8. If Menu

    If Menu

    If Menus is the next conditional logic plugin for WordPress on our list. It is a free WordPress plugin that you can use to create dynamic menus and control their visibility on your site.

    The plugin lets you use conditional logic to show or hide different menu items. For instance, it lets you display certain menu items only if a user is logged in, hide menu items on mobile devices, show specific menus to admin and editors, and more.

    Similarly, you can also show menu items to users from different locations or show any entirely new menu to members.

    9. FunnelKit

    FunnelKit Automations

    FunnelKit is the best WooCommerce sales funnel and automation plugin. It lets you create high-converting landing pages, order bump pages, upsells, checkout pages, and more.

    FunnelKit Automation offers multiple triggers that you can for automating workflows. You can set up different conditions, and based on the user’s actions, you can initiate different tasks.

    For example, if a customer adds products to the cart but doesn’t checkout, then you can trigger the cart abandonment recovery workflow.

    Similarly, you can automatically show different products to customers as upsells or order bumps. This way, you’ll increase sales without spending on paid ads.

    Which WordPress Conditional Logic Plugin Should You Use?

    Choosing the right conditional logic plugin for WordPress depends on your requirements and what you want to achieve.

    If you want to create dynamic forms that show different fields to users based on their selection, then WPForms is the best plugin. It is super easy to use and offers lots of customization options.

    Similarly, if you are looking to run different code snippets based on certain conditions, then WPCode is the perfect solution. It lets you set up rules and conditions without editing code.

    On the other hand, you can use OptinMonster to display different campaigns based on user actions or create conditional quizzes using Thrive Quiz Builder.

    You can also use conditional logic in WooCommerce and use FunnelKit to trigger workflows based on customers’ selections and actions.

    We hope this article helped you find the best WordPress conditional logic plugins. You may also want to see our list of best WooCommerce plugins and how to start your own podcast.

    If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

    The post 9 Best WordPress Conditional Logic Plugins for 2023 first appeared on WPBeginner.