Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter fahirsch

    (@fahirsch)

    “Fixed” the links by using phpadmin and modifying the entries directly

    open wp-content/plugins/simple-faq/faq.php

    Find this:

    function DisplayFAQ() {
        global $wpdb;
        $table_name = $wpdb->prefix . "faq";
    
        $select = "SELECT * FROM " . $table_name ." ORDER BY answer_date DESC";
        $all_faq = $wpdb->get_results($select);
    
        $buf = '<ol>';
        foreach ($all_faq as $q) {
    	$buf .= '<li>' . $q->question . '<br />';
    	$buf .= $q->answer.'</li>';
        }
        $buf .= '</ol>';
    
        return $buf;
    }

    replace with this:

    function DisplayFAQ() {
        global $wpdb;
        $table_name = $wpdb->prefix . "faq";
    
        $select = "SELECT * FROM " . $table_name ." ORDER BY answer_date DESC";
        $all_faq = $wpdb->get_results($select);
    
        $buf = '<ol>';
        foreach ($all_faq as $q) {
    	$buf .= '<li>' . stripslashes($q->question) . '<br />';
    	$buf .= stripslashes($q->answer).'</li>';
        }
        $buf .= '</ol>';
    
        return $buf;
    }

    The author forgot stripslashes (TERRIBLE!)

    The plugin works great actually, just not commented well in the installation screen. After activating, you will find “FAQ” in the admin panel under “PLUGINS” menu. I’m running v2.8.3. and all is well.

    To make the list a little more stylable with your theme, replace the code in faq.php with this (which also includes removing the escape character “\” slash too as mentioned above):

    function DisplayFAQ() {
        global $wpdb;
        $table_name = $wpdb->prefix . "faq";
    
        $select = "SELECT * FROM " . $table_name ." ORDER BY answer_date DESC";
        $all_faq = $wpdb->get_results($select);
    
        $buf = '<ol class="FAQ">';
        foreach ($all_faq as $q) {
    	$buf .= '<li>' . stripslashes($q->question) . '<br /><span class="answer">';
    	$buf .= stripslashes($q->answer).'</span></li>';
        }
        $buf .= '</ol>';
    
        return $buf;
    }

    I added a class for the ordered list item item called “FAQ” to define just that list and also added a span to include a class called “answer” to format just the answer.

    Hope this helps.
    Nice plugin. Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Simple FAQ] Introduces a slash and renders innoperative links’ is closed to new replies.