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

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.

|improve this answer|||||
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>
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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