Viewing 8 reply threads
  • Author
    Posts
    • #6691

      Hi, 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.
    • #6695
      Steve
      Keymaster

      Try using two fields:

    • #6703

      Hi, 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
      )
      )
      ));

    • #6705
      Steve
      Keymaster

      You 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.

    • #6710

      Hi, 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.

      http://prntscr.com/bh4nbd
      http://prntscr.com/bh4oes

    • #6723
      Steve
      Keymaster

      @ayron– I don’t think this is possible yet with a group and repeater.

    • #6724

      Do 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.

    • #8678

      Hi, Any possibility to deploy a button or link to open the url contained in a add more field? Thanks

    • #8680
      Steve
      Keymaster

      You 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 value of 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 field

      This 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. 😉

Viewing 8 reply threads
  • You must be logged in to reply to this topic.