简体   繁体   中英

How to call a function inside an iframe

I've made a function in wordpress with which I call an id into every post thru a shortcode. The function is:

function myshortcode_imdbid( ){
   $id = dt_get_meta('ids');
   return trim($id, 't');
}
add_shortcode( 'post_imdbid', 'myshortcode_imdbid' );

This function will print in every post a different id made of digits like: 232121

What I want to do is to call that ID into an iframe, do you have any idea on how to do that. Placing the shortcode inside the iframe won't work.

The iframe is always the same, only the ID is not the same. The iframe looks like:

<iframe class="API" frameborder="0" scrolling="no" data-apikey="XXXXXXXXXXXX" data-imdbid="HERE I MUST CALL MY ID"></iframe>

Do I need another function using that iframe and replace only the digits? If, so, any ideas? Big thanks for reading this and I hope that someone can help.

The issue was fixed. the user using adsense plugin. the adsense plugin doent support the php in admin settings textbox. so it is fixed by adding the below code in single-post.php

  <iframe class="API" frameborder="0" scrolling="no" data-apikey="XXXXXXXXXXXX" data-imdbid="<?php echo do_shortcode('[post_imdbid]');?>"></iframe> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM