Grab $_GET url parameter from an iframe - WORDPRESS

Asked

Viewed 1,316 times

2

I’m having a hard time, inside my website I put a iframe that has a button that directs to another page inside my site via GET.

only that this button is already gone.

ex.:

The link inside the iframe goes to http://www.meusite.com.br/Detalhes.php?id=17936

I think I have to create a page with the same name Details and within it put the function $_GET['id'];

I even used a plugin that reads php, and nothing..

I put an iframe inside my site from another server follows the website http://www.grupodisnave.com.br/seminovos/ and when I click on more details the link goes to another page with the id in the URL only wordpress does not allow me to use the GET

Does anyone have any idea what should be done?

  • 2

    Can you [Edit] the question and explain better "button that directs to another page inside my site"? Do you want to open this new page inside the iframe? does not serve only with an anchor?

  • Want to send a parameter to an IFRAME using the GET?? method or vice versa?

1 answer

1

You should "cheat" wordpress, since by passing parameters by url you get the error 404 Not Found. Create this simple plugin in your functions.php:

<?php

add_filter('query_vars', 'parameter_queryvars' );
function parameter_queryvars( $qvars )
{
$qvars[] = 'id';
return $qvars;
}
?>

HERE IS THE CONDITIONAL TO OBTAIN THE ID VALUE

global $wp_query;
if (isset($wp_query->query_vars['id'])){
print $wp_query->query_vars['id'];

//código aqui, da página
}
  • Helped? Mark as positive. Hug.

  • 1

    Thank you Lollipop for the quick response. I put an iframe inside my site coming from another server http://www.grupodisnave.com.br/seminovos/ and when I click in more detail the link goes to another page with the id in the URL only wordpress does not allow me to use GET

  • So you want to receive a GET, coming from an iframe, from your own website?

  • TELL ME: Site 1 - has the iframe Site 2 - your wordpress that has the iframe of the site 1 Ação: click on + details and be directed to where? SITE 1 OR 2?

  • directs to another page on site 1 http://www.grupodisnave.com.br/seminovos/

  • Waiting..........

  • edited,

  • Continue giving page not found..

  • Used the if (isset($wp_query->query_vars['id'])){ as ?

  • 1

    I created a wordpress page with the same name given in the link, put the code inside the post with this plugin "PHP Code for Posts and Pages" <iframe id="iframe" width="100%" height="1000px" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://gerenciador.publinkrio.net/client/detalhesveiculo.aspx?id=<? php global $wp_query; if (isset($wp_query->query_vars['id']){ print $wp_query->query_vars['id']; } ? >&client=204&backcolor=Ffffff&backcolorbutton=C40001">

  • 1 - Go to settings, permanent links and save settings. 2 - You have to give up what I said, because you did not say you created a page in wordpress, I thought it was a minhapagina.php, within the theme. 3 - Configure Permanent Links and always save.

  • I’m sorry I don’t understand. I’m supposed to take back the code you gave me ?

  • You’re in two trouble, my friend: 1 - If you have created a page by wordpress admin, and it is not appearing, it is because you need to update the permanent links. 2 - And when it works out, in case you’re looking to take the value of id by page.php, you should do what I instruct you about if (isset($wp_query->query_vars['id'])) Explain to me the structure of these pages you created in wordpress. IF THAT’S NOT WHAT YOU SAID.

  • 1

    It is a system of cars coming from outside, another server, they provided me an iframe to put on my site, my site was all developed in wordpress, the page of seminovos that comes from this external system comes via iframe or Soap, iframe put on my page.. So far so good. the problem is that their system when I click on more details it goes theoretically to another page on my site with the id in the URL referring to that car. only my links are configured with permalink not allowing the url that iframe generates so I’m not able to use the GET function to get the URL ID

  • You created these page by wordpress admin??

  • This by admin and put php code inside the post via plugin

  • Let’s go to chat

  • add my gmail, since it can’t go to chat: [email protected]

Show 13 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.