WordPress.org

Forums

Toolset Types
[resolved] Was types_render_field with a post ID ever implemented? (5 posts)

  1. joshuataylorx
    Member
    Posted 3 years ago #

    Was types_render_field with a post ID ever integrated? I saw previous posts stating this was included in 0.9.5 (such as http://wordpress.org/support/topic/types_render_field-image-with-specific-post-id?replies=8).

    Was this ever implemented? Can't see anything in the documentation about this, and would be great to use it outside The Loop.

    Thanks.

    http://wordpress.org/extend/plugins/types/

  2. Baden
    Member
    Posted 3 years ago #

    Hey Joshua,

    I was looking for the same thing. I know from past experience, that OnTheGoSystems prefers to use there own support system. Good luck with all that—it's pretty painful. Anyway, I just figured out a hack that works for me, try it and let me know if it works for you too:

    1. open up embedded > frontend.php
    2. in the types_render_field function, after global $post; (around line 57) add the following:
      //set post_id
          $post_id = $post->ID;
          if(!empty($params['post_id'])){
              $post_id = $params['post_id'];
          }
    3. change all instances of$post->ID to $post_id in the rest of the function:
      • around line 78: $meta = get_post_meta($post_id,
      • around line 126: $params['field_value'] = get_post_meta($post_id,
    4. now you can juist add the post_id into the params array like so:
      echo types_render_field('robot-avatar', array('post_id' => $robot_id, 'size' => 'thumbnail'));

    Hope this works for you, please let us know!

  3. Amir Helzer
    Member
    Plugin Author

    Posted 3 years ago #

    Why is our support forum painful?

    I'm adding this patch to our development queue and want to see what else it might effect.

  4. Samerkamel
    Member
    Posted 3 years ago #

    well .. i am using this :

    $variable = do_shortcode("[types field='field_slug' id='post_id']");

    i didnt want to edit the plugin code .. anyone has any input if using do_shortcode isnt a good idea ?

  5. fuentes7
    Member
    Posted 3 years ago #

    Hi Baden,

    your email ... ? for your help

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Toolset Types
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic