Skip to content

Instantly share code, notes, and snippets.

@webmasterninjay
Created February 21, 2022 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webmasterninjay/43d4fcf6d0416d2c0f522f9985b0c764 to your computer and use it in GitHub Desktop.
Save webmasterninjay/43d4fcf6d0416d2c0f522f9985b0c764 to your computer and use it in GitHub Desktop.
Genesis Framework: Use genesis_custom_loop as shortcode
<?php
add_shortcode( 'cibaria_loop', 'cibaria_loop_shortcode' );
function cibaria_loop_shortcode( $atts ) {
$param = shortcode_atts( [
'post_status' => 'publish',
'post_type' => 'post',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => -1,
], $atts );
$args = [
'post_status' => $param['post_status'],
'post_type' => $param['post_type'],
'orderby' => $param['orderby'],
'order' => $param['order'],
'posts_per_page' => $param['posts_per_page'],
];
ob_start();
genesis_custom_loop( $args );
$item = ob_get_clean();
return $item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment