Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter manex

    (@manex)

    Ok,thank you very much again. I will give it a try, 😀

    Thread Starter manex

    (@manex)

    Thread Starter manex

    (@manex)

    Thank you for your guidance, it was realy useful. As you said, once a draft is saved the content is accesible from the popup. FYI, this is how I accomplished it:

    1. To create the popup: Define this function for the action media_buttons to add the image as a button to media buttons.
      function oi_itzultzaile_botoia_gehitu()
      	{
      				$urla='"'.get_bloginfo("wpurl").'/wp-content/plugins/ohar-itzultzailea/itzulpen-orria.php"';
      				$izena='"'.__("Ohar Itzultzailea","ohar-itzultzailea").'"';
      
      				echo "<img src='".get_bloginfo("wpurl")."/wp-content/plugins/ohar-itzultzailea/irudiak/itzuli-botoia.png'
      					class='thickbox'
      					alt='Itzulpena abian jartzeko erabiltzen den botoia irudikatzen duen irudia'
      					onclick='leihoaIreki($urla,$izena)' style='cursor: pointer;'/>";
      
      	}
      
      	add_action('media_buttons', 'oi_itzultzaile_botoia_gehitu',20);

      Then, in the .js file with the functions define this function to open the popup:

      function leihoaIreki(urla,izena)
      {
      	window.open(urla,izena,"width=640,height=500");
      }

    2. In order to get the content of the editor from the popup:
      var aux=window.opener.document.getElementById("content").innerHTML;

    With the code above I solved the problem. There is one issue, though, the pop-up does not follow the standard appearance of WordPress(in the previous version with the anchor it followed the standard appearance). I’ve tried a few things but I could not accomplish it, do you know how to do it?

    Anyway, once again, thank you very much! 😀

    Thread Starter manex

    (@manex)

    Thank you for your answer, bcworkz.

    If I’ve understood correctly what I should do is the following:

    1. Add an action for the moment in which the post is published and open the pop-up in the registered function add_action( 'publish_post','pop-up_opener');
    2. As the post has already been published the content could be accessed from the pop-up window. Would something like this work? window.parent.getElementById("content").innerHTML;
Viewing 4 replies - 1 through 4 (of 4 total)