Support Forum
The function from the API "sp_is_forumpage" does not seem to be available in regular Wordpress template files.
The Codex indicates that there is an option in the admin that will need able be enabled in order to use these in the "Optimization Panel" area. However, that area does not seem to exist in this version of SimplePress.
Any ideas how I can get this function working within standard Wordpress template files? I need to change the header/footer depending on whether the visitor is on a forum page or not.
Thanks.
nor do I have any issue using it in wp themes...
if in a strange place, I guess you could try adding:
sp_forum_api_support();
before you make the check... shouldnt need it and if having problems finding the other function, may not find this one either...
like Andy was asking, sounds like you are referring to the wiki (v4) instead of the codex (v5)...
Visit Cruise Talk Central and Mr Papa's World
Yes, I did see that on the Wiki and thought it might be outdated, but wasn't sure.
Tried to use if(!sp_forum_api_support()) but it just made the forum not work at all, no errors but nothing displayed outside the header/footer of the Wordpress theme.
I am using it within a custom function in functions.php. To make a long story short, the site itself uses functions from an old version of jQuery (I am working with the frontend developer to update those calls which are incompatible with newer versions), therefore necessitating a load of a specific jQuery version, like so.
if (!function_exists('my_scripts_method')) { function my_scripts_method() { if (!is_admin()) { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'); wp_enqueue_script( 'jquery' ); } } } add_action('init', 'my_scripts_method');
The is_admin part works to fix the backend (this jQuery version is also incompatible with the backend portion of SimplePress) but I want to fix the frontend as well since certain portions of the forum are broken with this outdated version of jQuery.
I tried changing the if statement to
if (!is_admin() && !sp_is_forumpage()) {
But like I said it says the function doesn't exist at this point in Wordpress. I have perhaps a problem that may be related to this, which is when an Admin is logged into the Forum the "Add Topic" or "Reply" buttons are broken. I'm attempting to troubleshoot this but it appears the js is obfuscated somewhat which is making it hard to determine the exact error. I can see the hidden divs there (in fact, make them visible manually and submit a post), just the button does not work - no errors. Moderators and regular users can use this button fine.Thanks for your help.
Switching
add_action('init', 'my_scripts_method');
to
add_action('wp_enqueue_scripts', 'my_scripts_method');
Did fix this issue. So apparently sp_is_forumpage is available at the wp_enqueue_scripts hook, but not the init hook!
Thanks for the assistance. I still have the other issue, but I will open a new thread for that since it appears to be a separate issue.
1 Guest(s)