Viewing 5 reply threads
  • Author
    Posts
    • #3082
      dawood
      Member

      For a page, I’d like to be able to add an option for the user to select INDIVIDUAL posts Then, I’d like to be able to render those out, is that possible?

      The closest concept I’ve found is this Field, https://piklist.com/user-guide/docs/fields/post-post-relationships/

      In this case, the user selects the posts from the list and ONLY those are rendered out, right now it looks as though, we’d be able to only render posts RELATED to those.

    • #3083
      dawood
      Member
      piklist('field', array(
      'type' => 'select'
      ,'field' => 'dawood'
      ,'columns' => 12
      ,'attributes' => array(
        'multiple' => 'multiple'
      )
      ,'choices' =>  piklist(
                    get_posts(
                       array(
                        'post_type' => 'post'
                        ,'orderby' => 'post_date'
                       )
                       ,'objects'
                     )
                     ,array(
                       'ID'
                       ,'post_title'
                     )
      )
      ));
      ?>

      `// Gets the 3 Featured boxes
      $dawood=get_post_meta($post->ID, ‘dawood’, false);
      piklist(get_stylesheet_directory() . ‘/inc/dawood’, array(‘data’ => $dawood, ‘loop’ => ‘data’));
      `

      <?php echo $data; ?>

      The problem is that I only get the ID numbers and am trying to get the Post_title with the Permalink?

    • #3089
      Steve
      Keymaster

      @dawood– You can’t get the full permalink directly. Take the ID and use get_permalink().

      • #3097
        dawood
        Member
        This reply has been marked as private.
      • #3099
        Steve
        Keymaster
        This reply has been marked as private.
    • #3090
      dawood
      Member

      Thanks Steve, I got stuck trying to pass the ID variables into the function. I figured since the ID’s were what’s being output I could assign those a variable and then place that inside the get_permalink but it did not work…

      • #3108
        dawood
        Member
        This reply has been marked as private.
      • #3113
        Steve
        Keymaster
        This reply has been marked as private.
    • #3098
      Steve
      Keymaster

      @dawood– This should work after you run get_post_meta():

      foreach ($dawood as $key => $value)
      {
        echo get_permalink($value);
      }
      
    • #3118
      dawood
      Member
      This reply has been marked as private.
Viewing 5 reply threads
  • The topic ‘Select Box For Displaying Posts’ is closed to new replies.