Support » Plugin: Query Wrangler » Can't put PHP code into "Rewrite results" field?

  • Resolved boutzamat

    (@boutzamat)


    Hello “Author”.

    First of all, i would like to THANK YOU! for this AWESOME plugin i can’t live without!!
    Usually i use Drupal so you know how much this plugin must mean to me xD

    The “problem” is, that i am trying to rewrite a field from a custom content type made with CCTM plugin.

    The 2 plugins integrate perfectly together, but when i try to render a field that is showing related pages, it outputs the page id’s instead of names, and it does not link to the correct page, but the page that the field is “taken” from.

    I therefore tried to rewrite the result of the field and added a php code (same one as in my single-member.php template).

    This is the code <?php print_custom_field('forretningsomrde:to_link'); ?>

    In the persons own site Example here, this code <?php print_custom_field('forretningsomrde:to_link'); ?> works fine and renders all the correct related pages in a correct way.

    Is there a problem using php in “Rewrite results” ?

    https://wordpress.org/plugins/query-wrangler/

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

    (@daggerhart)

    PHP does not work in the Rewrite area, though this is a good idea that I may implement in the future. I’ll keep you up to date.

    Thanks alot 🙂

    Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Hi boutzamat,

    In the newest release (1.5.23), I added options for meta value (custom) fields that should help this issue.

    When editing a meta value field, if you have CCTM plugin active, you should be able to select it as the field’s “Display Handler”. Additionally, you can add CCTM output filters to the field.

    For example, if you have an Image field that is a repeater, you can; change the “Count” to 0, select “CCTM: get_custom_field” as the display handler, put “:to_array:raw” as the “CCTM Output Filters”, check “Load Image IDs as Images”, and select the “Image Display Style”. This should output the CCTM fields as images of the chosen style.

    Let me know if you get a chance to test this, and if you have any issues.

    Thanks,
    Jonathan

    Hi Jonathan.

    Once again thanks for your awesome plugin, and more awesome support ..

    You did it, it works excellent xD

    Only, then i look in the documentation of CCTM the only way to get the full path for my PDF’s (i want to make them downloadable instead of link to the post that has it attached) the only possible solutions for getting the full url for the pdf is:

    <?php print_custom_field(‘my_pdf:get_post’,’Download PDF‘); ?>

    OR

    “>Download PDF

    OR when using a tpl (e.g. via a summarize-posts shortcode)
    // If your query loops over the actual PDFs:
    Download [+post_title+]

    // If your query loops over pages with custom fields that contain the pdfs, you need to get the guid of the referenced pages:
    Download [+my_pdf:get_post==post_title+]

    i tried the filters supplied in the documentation, but none of them seems to give the desired result – full path for the file.

    There’s no way for running PHP in rewrite, is there? :/

    Thanks again, and sorry for bringing a post that might not be your “issue” .. but thanks for taking time to help ..

    Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Are you using the “Media” field type to upload the pdf? If not, what field type are you using, and could you explain a little about how you’re using it?

    I came upon this post looking for same. My intended use:

    <?php if($post->post_content != "") : ?><span class="green-btn"><a href="{{permalink}}">Full Profile</a></span><?php endif; ?>

    In keeping with my response to your Wish List post, where I nominated {empty} behavior for each field. 🙂

    Plugin Author Jonathan Daggerhart

    (@daggerhart)

    Hi tyme,

    I recommend looking at the “Callback” field for PHP support. I don’t plan on allowing PHP form within the QW interface. The FAQ has 2 examples of using a callback field. Tokens can be made available to the callback by including additional information (checkbox).

    http://wordpress.org/plugins/query-wrangler/faq/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can't put PHP code into "Rewrite results" field?’ is closed to new replies.