Support Forum
Actually you should be able to do this using just php.
Any code you write should be either placed in the 'spFunctions.php' file of your SP theme (and use a child theme to save losing changes on updates) - or - since Simple:Press version 5.5.7 you can drop a php file named 'sp-user-functions.php' into the wp-content folder and it will be included. This is then safe from future updates.
The Announcements plugin has a standard WP style filter hook you can use to add content to the announcement display. This is named 'sph_AnnounceMessage' and sends the $content to be changed/added to etc. There are details of this on our codex page for this plugin.
A dialog box can be opened by sending the content directly to it in something like an onclick event. So the button you add can use onclick. The JS function and calling arguments are:
spjDialogHtml(e, content, title, width, height, position, dClass)
made up of:
e | the button/link object making the call |
content | the formatted content to be displayed |
title | text for the popup title bar |
width | width of the popup or 0 for auto |
height | height of popup or 0 for auto |
position | set to zero to calculate. Or 'center' |
dClass | optional class to apply to overall dialog container |
If you are able to search through our code you will find a few examples. We could advise on this of course.
YELLOW
SWORDFISH
|
Thank you! I'm affraid I need more help.. This is what I read in the codex:
apply_filters(‘sph_AnnounceMessage’, $out, $a)
So I guess that call goes into spFunctions.php, right?
Now, should $out contain the extra content I like to add to the announcement:
spjDialogHtml($this, url_to_texfile, "title", 500, 400, "center") ?
I hope I'm moving into the right direction.. I tried to learn more about plugin-hooks, however unfortunately the section "plugin hooks" in the codex says "needs writing".
Thanks ,
Erik
For a tutorial on hooks see: http://codex.wordpress.org/Plugin_API
Essentially you would add your content additions to the $out variable and then pass it back in a return statement. So something like:
add_filter('sph_AnnounceMessage', 'your_announcement_content'); function your_announcement_content($content) { $content .= '---what you want to add---'; return $content; }
So there you would add your button with the onclick call to spjDialogHtml() and the data you send that would need to include the text of the text file.
YELLOW
SWORDFISH
|
Thank you Andy, I'm getting there... Also, I should have read that manual on hooks earlier.. Instead of spjDialogHtml I use spjDialogAjax now, not sure why but only the latter allowed me to refer to the URL of a textfile and load its contents.
So thanks for your help! - it's much appreciated 🙂
Erik
1 Guest(s)