Support

Account

Home Forums General Issues create a shortcode with filder for a field Reply To: create a shortcode with filder for a field

  • add_shortcode( 'qg_shortcode', 'qg_shortcode' );
    function qg_shortcode() {
        $buffer = '<h3>Post Titles</h3>';
        $q = new WP_Query(array(
            'post_type' => 'post',
            'posts_per_page' => 5
        ));
        while ($q->have_posts()) {
            $q->the_post();
            $buffer = $buffer.get_the_title().'<br>';
        }
        wp_reset_postdata();
        return $buffer;
    }