WordPress.org

Ready to get started?Download WordPress

Forums

Q and A FAQ and Knowledge Base for WordPress
[Plugin: Q and A - FAQ Plugin] Category Description (2 posts)

  1. Jandal
    Member
    Posted 3 years ago #

    WP 3.1
    Q&A: 0.2.1

    Hello,

    Thank you for an awesome plugin. I have just been styling my Q&A pages and doing some modding.

    I really wanted to take advantage of the Category Description when outputting my Q&A's.

    This is not the most efficient hack but it does the job. There are to many calls to the DB for a small amount of info, and I'm sure there must be a more efficient way to do this.

    File: q-and-a.php

    global $wpdb; $catname = $wpdb->get_var("SELECT name FROM $wpdb->terms WHERE slug = '$cat'");
    		$catnameid = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE slug = '$cat'");
    		$catdesc = $wpdb->get_var("SELECT description FROM $wpdb->term_taxonomy WHERE term_id = '$catnameid'");
    
    		if (!empty($cat)) {$qa_shortcode .= '<p class="faq-catname">'.$catname.'<br><span class="faq-catdesc">'.$catdesc.'</span></p>';}

    I have called out the description and then added some HTML/CSS to place it and style it.

    It would be great if this feature was added to the plugin.
    (With more efficient code ;-)

    HTH others too,
    Thanks,
    =-)

    http://wordpress.org/extend/plugins/q-and-a/

  2. Dalton Rooney
    Member
    Plugin Author

    Posted 3 years ago #

    Looks great, thanks for the code!

    Dalton

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags