-1

I wrote a simple plugin which creates a post type named cryptoevent and also creates a metabox that have some custom fields, I display this post type and fields with WP_Query, now I want to display them with a load more button, note this is supposed to be a plugin and I don't want user to have to do changes in his/her theme's function.php, here is my code, thank u for your help. and I'm a beginner, by the way, please help me in a simple language.

function cryptoevent_addform( $atts ) {

$args = array( 'post_type' =>'cryptoevent','posts_per_page'=>8);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
    echo '<div style="padding:0 15%;"><h2>';
    the_title(); ?>
    <p><?php echo get_post_meta( get_the_ID(), 'date_add', true ); ?></p>
    <p><?php echo get_post_meta( get_the_ID(), 'date_expiration', true ); ?></p>


    <?php
    echo '</h2></div>';
endwhile;
wp_reset_query();
}

add_shortcode( 'cryptoevent', 'cryptoevent_addform' );

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.