Quantcast
Channel: WP Woodshed
Viewing all articles
Browse latest Browse all 16

Hello, WP_Query

$
0
0

function ggb_display_author_posts() {

    global $ggb;

    $args = array(
        'author_name' => get_the_title($ggb_members["nickname"]),
    );

    $top10 = new WP_Query( $args );

    if( $top10->have_posts() ) {
        echo '<ul class="ggb-single-page-post-list">';
            while ( $top10->have_posts() ) {
                $top10->the_post();
                echo '<li class="ggb-single-post"><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
            }
        echo '</ul>';
    }
        wp_reset_postdata();
}
add_action( 'genesis_entry_content', 'ggb_display_author_posts' );

 


Viewing all articles
Browse latest Browse all 16

Trending Articles