WordPress.org

Support

Support » Plugins and Hacks » Code Categories

Code Categories

Viewing 15 replies - 1 through 15 (of 16 total)
  • I wanted the same thing.

    [faq cat=1] or [faq cat=1,5] would be great. That way we can filter things and have multiple faq pages on the same website.

    Hi guys,
    I wanted to do the same thing, its a great plugin.

    Here is how you can modify the shortcode function to have this capability:
    in /wp-content/plugins/wp-awesome-faq/index.php around line 87

    After:

    function h2cweb_accordion_shortcode($atts) {
    	// Registering the scripts and style

    ADD:
    extract( shortcode_atts( array('theslug' => 'general-questions'), $atts, 'faq' ) );

    Edit the following line that reads:

    $args = array( 'posts_per_page' => 50, 'post_type' => 'faq', 'faq_cat'=>"$theslug", 'order'=>'DESC');

    to read:
    $args = array( 'posts_per_page' => 50, 'post_type' => 'faq', 'faq_cat'=>"$theslug", 'order'=>'DESC');

    Once you have edited those two lines, you can use the shortcode like this:
    [faq theslug=’YOURSLUG’]
    Where ‘YOURSLUG’ is the category slug.

    Also, you can set the default slug in the line that you added first. My default slug in the example above is ‘general-questions’. This is the slug that will be pulled if one isn’t specified in the short code.

    Hope that helps!!
    -Scott

    if I make this modification to the plugin, will it get lost in the next auto update? Is the developer planning on adding this feature to the next release?

    Thanks,
    -Cat

    Hi Catherine,
    The modification would get overwritten if you updated the plugin. Not if you updated wordpress.

    Plugins don’t tend to auto-update, its usually your choice, so you would be safe.

    All that said, i’m not sure how active development is on this plugin, and if it will be updated in the future.

    Thanks!
    -Scott

    Thanks Scott – I’ll be sure not to update this plugin. I made your mods and the FAQs are not showing on product pages – see this example:

    http://victorybox.org/product/victory-box/

    I am using this code in the product short description:
    [faq theslug=victory-box]

    and I’ve added this code to the index.php:
    // Registering the scripts and style
    extract( shortcode_atts( array(‘theslug’ => ‘about’), $atts, ‘faq’ ) );

    // Getting FAQs from WordPress Awesome FAQ plugin’s Custom Post Type questions
    $args = array( ‘posts_per_page’ => 5, ‘post_type’ => ‘faq’, ‘faq_cat’=>”$theslug”, ‘order’=>”DESC”);
    $query = new WP_Query( $args );

    It’s pulling the default category, but not the one I created for the product. Am I missing something?

    Thanks!

    -Cat

    Hi Cat,
    I don’t see anything that jumps out, except for quotes on your short code. Try changing that to [faq theslug='victory-box'] and see if that helps.

    Thanks!
    -Scott

    thanks Scott – the product editor is not accepting the quotes – it changes them into:
    '
    even though I put the code in the text editor (not the visual).

    I wonder if there is a way to do this by category ID number without using quotes?

    thanks so much,

    -cat

    Catherine and Scott,

    Same thing on this end…displaying the default category only. Short code is certainly right on my end (proper quotes).

    Scott any chance we are missing a step?

    Hi Cat / wpatch,

    I have the same issue here. Just remove the default slug from shortcode_atts() method:

    Change that line:

    extract( shortcode_atts( array('theslug' => 'general-questions'), $atts, 'faq' ) );

    To:

    extract( shortcode_atts( array('theslug' => ''), $atts, 'faq' ) );

    =)

    Evan,

    Thanks for the response…didn’t do it for me either. Still outputs all not the category trying to filter:

    Here is my wp-awesome-faq/index.php
    http://pastebin.com/5di24Vhp

    I have three categories with slugs: appraisal – landlord – tenant

    Short code: [faq theslug=’appraisal’] still out puts all: http://welchgroup.net/index.php/appraisal-faq-new/

    Hi wpatch,

    On the line 87 change this:


    function h2cweb_accordion_shortcode() {

    for:


    function h2cweb_accordion_shortcode($atts) {

    =)

    That did it!

    Thanks for the help!

    wp

    thanks but now the FAQ is gone from the product… ?
    http://victorybox.org/product/illumination-box/

    has anyone figured a way to remove the “category” name from each posting ??

    say you have 4 categories, and 4 faqs in each, it will post the category name after each FAQ if you have them assigned to the CAT.

    has anyone found a better plugin that is actually being monitored and supported by the developer?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Code Categories’ is closed to new replies.