I want to implement a system to insert custom links in my wordpress custom theme. I don't want to hardcode these links inside my theme. These links are for the socials or partners website. So they need to be easily changed from WordPress dashboard. I want to avoid registering a custom post type or using a post. Is this possible with a custom function or a similar solution?
You could use ACF https://www.advancedcustomfields.com/ and create a custom field for the links. Then use the value in the template. The ACF web site has some great documentation and examples.
-
-
@Yikko Yes, you can use the custom fields option in the top bar of the WordPress page admin section. her is a link to the add_meta_box() that you will need to use in your template. developer.wordpress.org/reference/functions/add_meta_box There is also a good tutorial on Sitepoint sitepoint.com/adding-custom-meta-boxes-to-wordpress – J.Bigham May 15 '19 at 18:28
I think there are multiple ways of adding dynamic links to your theme. For example,
- Theme Customization API / Customizer
- Settings API
- Navigation menus
- Links manager (maybe outdated?)
- If the links are shown on a certain page (template), then maybe a custom meta box