Answers for "wp_list_custom_post type"

PHP
1

wp_list_custom_post type

$projectsLoop = new WP_Query(array('post_type' => 'project', 'posts_per_page' => -1));
echo '<h2> Projects: </h2>';
echo '<ol>';
    while ($projectsLoop->have_posts()) : $projectsLoop->the_post();
        $title = get_the_title();
        $href = get_the_permalink();
        echo "<li><a href='$href'>$title</a></li>";
    endwhile;
echo '</ol> <hr/>';
Posted by: Guest on July-25-2021

Browse Popular Code Answers by Language