المنتديات
The great place to discuss topics with other users
Add Buttons to Clickable custom Fields
'Hello! this sound amazing, I have a question: example the custom fields are named like "Link 1", "Link 2", etc. - how can we made it to have a custom name in the Button label, that maybe users can add?
Example
Link1
https://www.pippo.com Label: Pippo Land
is possible easily or is it too much complex?
Before

After

Open content/themes/default/templates/__feeds_post.body.tpl
look for
{if $_post['custom_fields']['basic']} <div class="post-custom-fileds-wrapper mt10"> {foreach $_post['custom_fields']['basic'] as $custom_field} {if $custom_field['value']} <div> <strong>{__($custom_field['label'])}</strong><br> {if $custom_field['type'] == "textbox" && $custom_field['is_link']} <a href="{$custom_field['value']}">{__($custom_field['value']|trim)}</a> {elseif $custom_field['type'] == "multipleselectbox"} {__($custom_field['value_string']|trim)} {else} {__($custom_field['value']|trim)} {/if} </div> {/if} {/foreach} </div> {/if}
and replace with
<!-- custom fileds scriptsTribe --> {if $_post['custom_fields']['basic']} <div class=" mt10"> {foreach $_post['custom_fields']['basic'] as $custom_field} {if $custom_field['value']} <div class="mb-2">
{if $custom_field['type'] == "textbox" && $custom_field['is_link']} <a href="{$custom_field['value']}" class="btn btn-sm btn-primary mt-1" target="_blank"> {__($custom_field['label'])} </a> {elseif $custom_field['type'] == "multipleselectbox"} {__($custom_field['value_string']|trim)} {else} {__($custom_field['value']|trim)} {/if} </div> {/if} {/foreach}
open
look for content/themes/default/templates/page.tpl
<!-- custom fields [basic] --> {if $custom_fields['basic']} <div class="card"> <div class="card-header bg-transparent"> {include file='__svg_icons.tpl' icon="info" class="main-icon mr5" width="24px" height="24px"} <strong>{__("Info")}</strong> </div> <div class="card-body"> <ul class="about-list"> {foreach $custom_fields['basic'] as $custom_field} {if $custom_field['value']} <li> <strong>{__($custom_field['label'])}</strong><br> {if $custom_field['type'] == "textbox" && $custom_field['is_link']} <a href="{$custom_field['value']}">{__($custom_field['value']|trim)}</a> {elseif $custom_field['type'] == "multipleselectbox"} {__($custom_field['value_string']|trim)} {else} {__($custom_field['value']|trim)} {/if} </li> {/if} {/foreach} </ul> </div> </div> {/if} <!-- custom fields [basic] -->
And replace with
<!-- custom fields [basic] -->{if $custom_fields['basic']} <div class="card"> <div class="card-header bg-transparent"> {include file='__svg_icons.tpl' icon="info" class="main-icon mr5" width="24px" height="24px"} <strong>{__("Info")}</strong> </div> <div class="card-body"> <ul class="about-list"> {foreach $custom_fields['basic'] as $custom_field} {if $custom_field['value']} <li class="mb-2"> <strong>{__($custom_field['label'])}</strong><br>
{if $custom_field['type'] == "textbox" && $custom_field['is_link']} <a href="{$custom_field['value']}" class="btn btn-sm btn-outline-primary mt-1" target="_blank"> {__("Visit")} </a> {elseif $custom_field['type'] == "multipleselectbox"} {__($custom_field['value_string']|trim)} {else} {__($custom_field['value']|trim)} {/if} </li> {/if} {/foreach} </ul> </div> </div>{/if}<!-- custom fields [basic] -->