• Resolved ben4d85

    (@ben4d85)


    How can I display a number of random, or latest FAQs? Is there a general way via the custom-post-type feature, or how does it work?

    I would need the php-code, please.

    Many thanks,
    Ben

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Andrew Norcross

    (@norcross)

    Read through the shortcode options to see what’s built in. There are also sidebar widgets available. If you need something else, feel free to review the code and make something to suite your needs.

    Thread Starter ben4d85

    (@ben4d85)

    Thanks for your reply. If anyone has the same problem, both random and recent FAQs can easily be obtained by writing your own functions based on the supplied widget functions.

    Example for Recent FAQs:

    // Recent FAQs (based on Widget-code)
    function recentFaqs( $numberposts ) {
        echo '<ul id="recentFaqs">';
        global $post;
            $args = array(
                'posts_per_page'    =>    $numberposts,
                'post_type'         => 'question',
                'post_status'        => 'publish',
                );
        $faqs = get_posts( $args );
        foreach( $faqs as $post ) :    setup_postdata($post);
           $title=get_the_title($post->ID);
        echo '<li><span class="questionTitle">'.$title. '</span>
        <a class="answerLink" href="'.get_permalink($post->ID).'" title="'.get_the_title($post->ID).'">Answer</a>
        </li>';
        endforeach;
        echo '</ul>';
        wp_reset_query();
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: FAQ Manager] Random and Latest FAQs’ is closed to new replies.