• Is it possible to put and iframe in any of the database fields – I’ve tried using a rich text field and entered this on the “Text” tab and if shows on the “Visual”, but then when I update the post this disappears.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author xnau webdesign

    (@xnau)

    It’s not possible to insert an iframe into a rich text element and probably you don’t want your users doing that, as it can be a security risk.

    To accomplish this, you can try using a “shortcode” form element and configure the field to use a shortcode that will display an iframe. I don’t have the details on that at this moment, but it is in theory possible.

    This will give you a way to validate the user’s input to address possible security issues.

    Thread Starter in-business

    (@in-business)

    Thank you – I have tried that and it doesn’t work, and by the way it is only myself that will enter this and it will be a default field.

    On the basis it won’t be users doing this, can you suggest another way to achieve this please?

    Plugin Author xnau webdesign

    (@xnau)

    What did you try? I’m pretty sure this will work.

    The only other way to do this is with custom code.

    Thread Starter in-business

    (@in-business)

    Hi – I tried setting up a ‘Shortcode’ field and entered this in the shortcode on the field settings:

    <iframe src="https://www.url.com/" rel="nofollow" width="100%" height="650"></iframe>

    But when I enter it as shortcode on a blog post it looks like this with the <p> (I have tried it with the <p> too and it still doesn’t work:

    <p><iframe src="https://www.url.com/" rel="nofollow" width="100%" height="650"></iframe></p>

    Not sure if I should enter the short code in the shortcode field or on the field that shows on the Participant Record?

    Plugin Author xnau webdesign

    (@xnau)

    OK, if you take a look at the description of how to configure a shortcode field, it has to be a shortcode, not HTML.

    You need use a shortcode that will display an iframe, I don’t know if WordPress has one built in, if not you may need to create it, or maybe there is a plugin that will add one.

    Plugin Author xnau webdesign

    (@xnau)

    I remembered that I wrote a plugin that adds an “iframe” field type to Participants Database:

    https://gist.github.com/xnau/613f05399cd4aa7d92e21b2516a472e0

    How to Install a WordPress Plugin from a Gist

    Thread Starter in-business

    (@in-business)

    Ok, and to help me understand the code I am entering in the Shortcode field vs what the entry is expecting on the Participants Record, let me explain another time I’ve used this (by the way I wasn’t too sure if this question should take this to the Add-on), but I don’t think so, but here goes.

    I have used the short code to list a table using this: [pdb_list search=true sort=true display_count=true list_limit=24 orderby=”last_name,first_name” order=”asc,asc” filter=”approved=yes” fields=”first_name, country, link_to_post, review_rating, flexible_booking_yes_no, boat_length, maximum_guests, sde_lux_rating_pct”]

    The above is what I created as an output for a table.

    To make this work I then have to enter the exact same code into the field entry cell on the Participant Record – i.e. if I leave it blank nothing is shown on the post.

    I would love to be able know how to change the above code so that on the Participant Record I simply enter the “country” so that the table is output only showing the one country, or what ever else I would like the table to output as.

    • This reply was modified 2 years, 9 months ago by in-business.
    • This reply was modified 2 years, 9 months ago by in-business.
    • This reply was modified 2 years, 9 months ago by in-business.
    Plugin Author xnau webdesign

    (@xnau)

    As far as I can tell, and I’m not sure I understand what you’re trying to do here, this question is only about Participants Database.

    If you want to experiment with using a [pdb_list] shortcode in a shortcode field, you can do that, it is in theory possible, but with possibly unexpected results. This is absolutely not what that field type is designed to do. Again, I’m unsure if this is what you want.

    The shortcode field works by building a shortcode and displaying it. I builds the shortcode by replacing a value in the “shortcode” setting in the field definition with the value of the field.

    Based on what I think you are asking about, you could set the shortcode field up with something like this: [pdb_list fields=%s]

    Then if the value of the field is “country” it will display the shortcode as though it were: [pdb_list fields=country] which would display a list with only the values form the “country” field.

    You can, of course, add any other attributes to the shortcode you want.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Using and iframe’ is closed to new replies.