WordPress.org

Ready to get started?Download WordPress

Forums

Calling a function (13 posts)

  1. cruthas
    Member
    Posted 2 years ago #

    I have the "Ask a question" plugin that needs to call a PHP function bjaq_form() (http://bradjasper.com/blog/wordpress-plugin-ask-a-question-update.html) the wordpress plugin is: http://wordpress.org/extend/plugins/ask-question/

    I am not sure how to get it to work though or where to put the function call. Any help would be appreciated.

    website is buildingadvisor.com
    thanks!

  2. cruthas
    Member
    Posted 2 years ago #

    Anyone have any input? Still banging my head...

  3. shirazdrum
    Member
    Posted 2 years ago #

    Assuming that the function actually exist.

    <?php bjaq_form() ?>

  4. cruthas
    Member
    Posted 2 years ago #

    Yes I think this is it...

    function bjaq_form() {
    
        global $aErrors;
    
        $sContent = "";
    
    	if (get_request_var("bjaq_action") == "bjaq_success") {
            $sContent .=  '<div id="bjaq-result">Successfully submitted message!
                <a href=".">Submit another</a>.</div>';
    	} else {
    
            $bjaq_error = "";
            if (get_request_var("bjaq_action") == "bjaq_error") {
                $err_type = get_request_var("bjaq_error");
    
                if (!isset($aErrors[$err_type])) {
                    $err_type = "unknown";
                }
    
                $sContent .= '<div id="bjaq-result">' . $aErrors[$err_type] . '</div>';
            }
    
            $sContent .= bjaq_form_html()
                . ' <div id="bjaq-result">' . ($bjaq_error ? $bjaq_error : '') . '</div>';
    	}
    
    	$sContent .= '</noscript>';
    
    	$sContent = '<h3>Ask A Question</h3>' . PHP_EOL . $sContent;
    
    	echo($sContent);
    }

    Now I just don't know how to get the form in my sidebar... There is nothing in the widgets options...

  5. shirazdrum
    Member
    Posted 2 years ago #

    ^^^READ....UP^^^

  6. cruthas
    Member
    Posted 2 years ago #

    I don't understand?

  7. shirazdrum
    Member
    Posted 2 years ago #

    <?php bjaq_form(); ?>

    THIS IS HOW YOU CALL THE FUNCTION.

  8. cruthas
    Member
    Posted 2 years ago #

    Yes I understand that, but I am unfamiliar with PHP. I have tried adding the following <?php bjaq_form(); ?> to my functions.php but had no luck. I don't know where to put the piece of code is what I was trying to say.

  9. shirazdrum
    Member
    Posted 2 years ago #

    I see. You need to put it where you want the form to show. IF sidebar, put it in the sidebar, if single post, put it in single and so on. It doesn't go inside your function.php. The code you wrote above should already be in there. Hope that helps.

  10. shirazdrum
    Member
    Posted 2 years ago #

    Of course the password to your site would be nice as well :)

  11. cruthas
    Member
    Posted 2 years ago #

    Great! Thanks! I got it to show in the sidebar now. I will see what I can do about getting it to look right. Thanks!

  12. shirazdrum
    Member
    Posted 2 years ago #

    Great, now you can style it with css.

  13. cruthas
    Member
    Posted 2 years ago #

    On it! Thanks again for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.