-
AuthorPosts
-
July 26, 2023 at 4:47 am #1414477
I have a custom post type that has advanced custom fields involved. I’m using a plugin I created with a shortcode to display the loop. I’m not able to use the Layout Builder because of the advanced custom field and some complications of moving a site with 1800 posts from an old theme into Enfold.
I need to add pagination to the page (via the plugin presumably) and I’m not seeing a code snippet that would do that. Can anyone help with some code to add pagination?
July 29, 2023 at 12:43 pm #1414810Hey bb,
Thanks for your patience, since you are using a plugin to display your custom post type grid, you will need to find out if the plugin supports pagination, when I check the plugin website it is in maintenance mode and I can’t find anything about the plugin, I recommend using the email form on the plugin web site and ask your question.
Since you ar not using Enfold to create or display the post grid, there is not anyway for us to help since our support is limited the theme.Best regards,
MikeJuly 29, 2023 at 7:44 pm #1414852Oh sorry – to clarify, I’m making the plugin myself, just so I can use a shortcode to display the loop. There’s no real plugin website and no support, it’s just me trying to get a loop to work with pagination. Looking for the right code snippet. The custom post type was created for use with the previous theme (and not by me) and I’m trying to modify the use of it for Enfold. The previous setup used Custom Post Type Maker, and made a custom post type but didn’t use the taxonomy module.
Maybe the custom post type/taxonomy setup is what’s not done correctly?Here is the code from my attempt so far:
// Create Shortcode to display Past Issuesfunction wmnpress_shortcode_eedition_post_type(){ ?>
<?php
$args = array(
‘post_type’ => ‘eedition’,
‘posts_per_page’ => 12,
‘paginate’ => ‘yes’,
‘use_main_query_pagination’ => ‘yes’,
‘order’ => ‘DESC’,
‘orderby’ => ‘date’,
);
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class=”past-editions flex_column av_one_third avia-builder-el-2 el_after_av_textblock el_before_av_one_third flex_column_div column-top-margin”>
<section class=”av_textblock_section “>
<div class=”avia_textblock” itemprop=”text”>
<p>
” target=”_blank” rel=”noopener”>” alt=”Newspaper cover page” width=”793″ height=”1024″ />” target=”_blank” rel=”noopener” data-wplink-edit=”true”><?php the_title(); ?>
</p>
</div>
</section>
</div>
<?php endwhile; ?><?php wp_reset_postdata(); ?>
<?php endif;
}
add_shortcode( ‘eedition-display’, ‘wmnpress_shortcode_eedition_post_type’ ); ?>July 29, 2023 at 9:53 pm #1414871 -
AuthorPosts
- You must be logged in to reply to this topic.