Excellent
-
Does what is says.
Would be great if shortcode could accept en ID as a parameter.
Would be great if description would show the slug of the cpt, which is ‘code-snippets’
Would be great also to have a straight forward example of a query to dispplay all snippets on a page.For those who would like to see an example, this is what i did in a template page :
// WP_Query arguments
$args = array (
‘post_type’ => ‘code-snippets’,
‘posts_per_page’ => ‘-1’,
‘order’ => ‘ASC’,
);// The Query
$myquery = new WP_Query( $args );while ($myquery->have_posts()) {
$myquery->the_post();
?>
<article id=”page-<?php the_ID(); ?>” class=”page” role=”article”>
<header class=”page-header”>
<h1 class=”page-title”><?php the_title(); ?></h1>
</header>
<?php echo do_shortcode(‘[snippet slug=’.$post->post_name.’ lang=php]’); ?>
</article>
<?php }
wp_reset_postdata();
- The topic ‘Excellent’ is closed to new replies.