0

I want to have the option to have social media icons that will link to different URLs. I currently have it set up so the user can click which icons will display on the page, but how would I have it so they can change the link to what URL they want?

2 Answers 2

2

Sounds like you're on the right path. Create a Global matrix field containing an asset field for Social Icon, a text field for Social Url, and a lightswitch field for Enabled/Disabled. Then the user can add new social media icons as needed and manipulate the url.

1

Many, many possible ways to go about this, but the simplest would be to create a Plain Text field in the control panel and call it something like "Social Media Link" with a handle of "socialMediaLink" and give it some field instructions along the lines of "Enter the URL for the social media button".

Attach that to the field layout for your section.

When your client edits the entry for that section, then can enter whatever URL they want.

Your template would display it something like:

<a href="{{ entry.socialMediaLink }}"><img src="mySocialMediaButton.jpg"></a>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.