Forums

[Plugin: Simple FAQ] Introduces a slash and renders innoperative links (4 posts)

  1. fahirsch
    Member
    Posted 2 years ago #

    If you put a link it puts a "\" in front of " so the link does not work

    http://wordpress.org/extend/plugins/simple-faq/

  2. fahirsch
    Member
    Posted 2 years ago #

    "Fixed" the links by using phpadmin and modifying the entries directly

  3. Qoolos
    Member
    Posted 2 years ago #

    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!)

  4. John_6x6
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags