Closed ikishorkumar closed 1 year ago
Solution : Here is the code to list all items using short code but there something missing i can't make to open the item page
<?php
// Define the shortcode function
function wpip_list_items_shortcode() {
// Query the database for all items with the post type "wpi_item"
$items = new WP_Query(array(
'post_type' => 'wpi_item',
));
// Start the output variable with an opening unordered list tag
$output = '<ul'.' '.'id=itemsListall >';
// Loop through the items and add them to the output variable
if ( $items->have_posts() ) {
while ( $items->have_posts() ) {
$items->the_post();
$output .= '<li>';
$output .= '<h2>' . get_the_title() . '</h2>';
$output .= '<p>' . get_the_content() . '</p>';
$output .= do_shortcode('[getpaid item=' . get_the_ID() . ' button="Clear Dues"]');
$output .= '</li>';
}
}
// Add a closing unordered list tag to the output variable
$output .= '</ul>';
// Reset the post data
wp_reset_postdata();
// Return the output variable
return $output;
}
// Register the shortcode
add_shortcode( 'wpip_list_items', 'wpip_list_items_shortcode' );
?>
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.