- This topic has 8 replies, 2 voices, and was last updated 4 years ago by
Steve.
-
AuthorPosts
-
-
June 15, 2016 at 5:54 pm #6691
Fernando LourençoMemberHi, How can I open a web (hyperlink) address from the value of a field. In the post edit mode. A button or hyperlinked text as illustrated in figure.
Attachments:
You must be logged in to view attached files. -
June 15, 2016 at 10:03 pm #6695
SteveKeymasterTry using two fields:
-
June 16, 2016 at 9:04 am #6703
Fernando LourençoMemberHi, Steve.
It works. I think you already knew that did. Thank you.I created a group, but he accuses an error. See ***
You know how to solve it?piklist(‘field’, array(
‘type’ => ‘group’
,’field’ => ‘links’
,’label’ => __(‘Links’)
,’add_more’ => true
,’fields’ => array(
array(
‘type’ => ‘url’ // HTML5 url field
,’field’ => ‘my_url’
,’columns’ => 10
,’template’ => ‘field’
,’attributes’ => array(
‘class’ => ‘regular-text’
)
)
$my_url = get_post_meta($post->ID, ‘my_url’, true); // Get the value of the field above ***(ERROR)
,array(
‘type’ => ‘html’
,’template’ => ‘field’
,’value’ => !empty($my_url) ? ‘ID, ‘my_url’, true) . ‘”>Go Url‘ : ” // if a url has been entered, show it. If not, show nothing.
,’columns’ => 2
)
)
)); -
June 16, 2016 at 9:50 am #6705
SteveKeymasterYou can’t put
$my_url = get_post_meta($post->ID, ‘my_url’, true), right in the middle of the field. Put it above the field function. -
June 16, 2016 at 10:28 am #6710
Fernando LourençoMemberHi, Steve
I had tried to insert a row above the field function.
No complains error, but does not work in the group. It works with the field outside the group. -
June 16, 2016 at 12:51 pm #6723
-
June 16, 2016 at 1:54 pm #6724
Fernando LourençoMemberDo not worry. Thanks for the effort.
I am making use of the solution indicated for the fields that are not grouped.
I do not want to disturb you with basic questions. In this new area, I’m still a beginner, and sometimes ask for help. 🙂
I imagine that as new features that are implemented will be available in the documentation or examples.
It’s the kind of contribution that extends the ability to use the framework. -
January 16, 2018 at 8:09 am #8678
Fernando LourençoMemberHi, Any possibility to deploy a button or link to open the url contained in a add more field? Thanks
-
January 16, 2018 at 12:11 pm #8680
SteveKeymasterYou can do this with Piklist and wrapping your fields in a standard PHP If-then-else conditional.
-First create another field: HTML field with the value being the URL field. So, if the URL is being saved as post_meta, the
valueof your HTML field will be:'value' => get_post_meta($id, $key, $single)-check if the url field is set
-if YES: show HTML field, hide URL field
-if NO: show URL field, hide HTML fieldThis allows you to have full control how the link, button or whatever you want should look and be styled.
Because Piklist is a full-featured code-based framework, there is usually a solution to most issues. 😉
-
-
AuthorPosts
- You must be logged in to reply to this topic.