skip to Main Content

I’m trying to open the user_url within an iframe on a private user page in WordPress.

I put the following code into a snippet:

<?php echo get_the_author_meta('user_url',$userID); ?>

When I use the short code on the user page it does display the user URL, I can also use it in an hyperlink like this:

<a href="[cmruncode name='dash']">link text</a>

But when I put the short code into an Iframe the short code does not change into the URL anymore.

<iframe src="[cmruncode name='dash']" height="300" width="300" title="Iframe"></iframe>

Does anyone knows why this is not working and know a solution?

Thanks Peter

3

Answers


  1. Chosen as BEST ANSWER

    This only works when I put it directly into the template, in that case no snippet-shortcode is needed at all. But the content needs to be hidden when the user is logged-out.

    Normally the plugin "client portal" that I use should take care of this but it has a content block that does not support PHP and also does not render the php snippet that I made.

    Any suggestions?


  2. If you are using WordPress shortcode then you have to call shotcode using function do_shortcode.

    You can try this one

    <iframe src="<?php echo do_shortcode( '[cmruncode name="dash"]' ); ?>" height="300" width="300" title="Iframe"></iframe>
    

    And I’m not sure why anchort text display right output. That’s weird.

    Anyway if you used do_shortcode to output your shortcode then it will work every place.

    Login or Signup to reply.
  3. The solution was to put the iframe code completely into a snippet.
    Like this:

    <iframe src="<?php echo the_author_meta('user_url',$userID); ?>" height="2400" width="100%" title="Iframe"></iframe>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search