What's your biggest current challenge? Have your say in Community Polls along the right column.

Add custom text to Login page

Add custom text to Login page

yourbudweiser
New Member
10 0 0

Using the Dawn theme, I know I can hard-code text on the Login page by editing the main-login.liquid file but how can I edit this text later without having to edit the liquid file? How can I add a custom field so that I can change the text later through the Shopify admin? So If I have  add this code:

 

<p>
    Enter your credentials and select the "Sign In" button to access your account.
</p>

How can I edit that later without having to edit the liquid file? I do see fields in the "Theme Content" settings for the Accounts (classic) Login page which would be the perfect spot for this.

 

 

Reply 1 (1)

Ahmad31
Shopify Partner
111 9 8

To make the text on your login page editable without modifying the Liquid file directly, you can add a custom field to the Theme Content settings through Shopify's Custom Fields. Here's how you can do that:

Step 1: Add the Custom Field to the Theme Settings

  1. Go to the Online Store in your Shopify Admin.
  2. Under Themes, click Customize on the Dawn theme.
  3. In the theme editor, look for Theme settings at the bottom left.
  4. Open the Theme settings and check if there's an option for Accounts or Login.
  5. If there isn't a pre-existing field for the text you want to edit, you will need to create a custom setting for it. To do this, you'll need to edit your theme's settings_schema.json file.

Step 2: Add a Custom Field in settings_schema.json

You can add a custom field in the settings_schema.json file to make it editable from the admin. Here's an example of how to add a text area setting:

  1. In the Shopify Admin, go to Online Store > Themes > Actions > Edit Code.
  2. Open the config/settings_schema.json file.
  3. Add a new setting for your custom text, like this:
    {
    "name": "Login Page Text",
    "settings": [
    {
    "type": "textarea",
    "label": "Custom Text for Login Page",
    "id": "login_page_text",
    "default": "Enter your credentials and select the 'Sign In' button to access your account.",
    "info": "This text will be displayed on the login page."
    }
    ]
    }

    Step 3: Update the main-login.liquid File to Display the Custom Text

    Now, in your main-login.liquid file (or wherever you want the text to appear), use the following code to pull the custom text from the settings:

    <p>
    {{ settings.login_page_text }}
    </p>

    Step 4: Customize the Text in Shopify Admin

    After you've added the setting and updated the Liquid file, you'll be able to change the text from the Shopify Admin:

    1. Go to Online Store > Themes.
    2. Click Customize next to your theme.
    3. Go to Theme Settings (bottom-left corner).
    4. Find the Custom Text for Login Page field under the Accounts or Login settings.
    5. Edit the text and save.

    Now, you can modify the login page text directly from the Shopify Admin without needing to access or modify the Liquid files again.


    If you're unsure how to make changes to the code, don't hesitate to contact me. I'm here to help!
Love my work? Buy me a coffee!
Hire Me: Email me Or Chat on Whatsapp
If you found my solution helpful, please like and accept it. Your support is greatly appreciated!