manex
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Hacks
In reply to: Get post editor content from pop-upOk,thank you very much again. I will give it a try, 😀
Forum: Hacks
In reply to: Get post editor content from pop-upForum: Hacks
In reply to: Get post editor content from pop-upThank 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:
- 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"); } - 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! 😀
Forum: Hacks
In reply to: Get post editor content from pop-upThank you for your answer, bcworkz.
If I’ve understood correctly what I should do is the following:
- 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'); - 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;
- To create the popup: Define this function for the action media_buttons to add the image as a button to media buttons.
Viewing 4 replies - 1 through 4 (of 4 total)