Support » Plugin: Query Wrangler » Add PHP in 'rewrite output of this field' ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Hi foochuck,

    I currently don’t support PHP in the rewrite area, though may in the future. I’ll let you know when I get something you could use for this issue into place.

    Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Hi foochuck,

    I’ve added a new field in 1.5.24 that allows for a custom callback function to provide the field’s output.

    For this case, you would use the field as follows:

    1. When editing the query, add the new field “Callback” field to your query.
    2. Edit the Callback field and for “Callback” setting, type: “my_custom_get_attachment_url”. Also check the setting “Include additional information.”
    3. Save the query.
    4. Open your theme’s function.php file, scroll to the bottom, and add the following on a new line:
    5. function my_custom_get_attachment_url($post, $field, $tokens){
      return wp_get_attachment_url($tokens['{{meta_video_thumbnail}}']);
      }
    6. Save the file.

    Your query should now show the results you were going for.

    If you’re comfortable with code, then this should give you a decent start. I may still add the option to use PHP in the rewrite_output field in the future, but for now I thought this would be helpful.

    Let me know if you run into issues.

    Thanks,
    Jonathan

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add PHP in 'rewrite output of this field' ?’ is closed to new replies.