- This topic has 9 replies, 3 voices, and was last updated 6 years ago by Tom.
-
AuthorPosts
-
April 6, 2018 at 3:05 am #542788Alessio Angeloro
Hi Tom,
i create some custom post type with custom taxonomy, now i need to view it at front end by using “customizer” -> 3 coluns layout, but may be i’m wrong something, which the correct file that i must duplicate in my template child to loop my custom post type ? because the customizer wont works on my my custom template cpt.
Regards,
April 6, 2018 at 8:28 am #543035LeoStaffCustomer SupportHi there,
This should help: https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type
Adding PHP: https://docs.generatepress.com/article/adding-php/
April 6, 2018 at 11:13 am #543167Alessio AngeloroHi Leo,
i apologize but not working.
This is my code : archive-annunci.php
<?php /** * The template for displaying Archive pages. * * Learn more: http://codex.wordpress.org/Template_Hierarchy * * @package GeneratePress */ get_header(); ?> <?php $cpt_query = new WP_Query(array( 'post_type' => 'annunci', 'taxonomy' => 'categoria_annunci', 'posts_per_page' => 25, 'orderby' => 'none', 'order' => 'DESC' )); ?> <div id="primary" <?php generate_content_class();?>> <main id="main" <?php generate_main_class(); ?>> <?php /** * generate_before_main_content hook. * * @since 0.1 */ do_action( 'generate_before_main_content' ); ?> <?php if( $cpt_query->have_posts() ): ?> <?php while( $cpt_query->have_posts() ) : $cpt_query->the_post(); ?> <?php get_template_part( 'content', 'page' ); echo get_the_term_list( $post->ID, 'categoria_annunci', '', ', ' ); // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || '0' != get_comments_number() ) : ?> <div class="comments-area"> <?php comments_template(); ?> </div> <?php endif; endwhile; /** * generate_after_main_content hook. * * @since 0.1 */ do_action( 'generate_after_main_content' ); ?> </main><!-- #main --> </div><!-- #primary --> <?php //endwhile; ?> <?php endif; ?> <?php /** * generate_after_primary_content_area hook. * * @since 2.0 */ do_action( 'generate_after_primary_content_area' ); generate_construct_sidebars(); do_action('generate_sidebars'); get_footer();
April 6, 2018 at 11:09 pm #543493TomLead DeveloperLead DeveloperAny chance you can link me to one of those CPT pages?
April 7, 2018 at 3:05 am #543590Alessio AngeloroSure, http://monkeydev.it/ec/categoria_annunci/auto/
Thanks.
April 7, 2018 at 10:58 am #543941TomLead DeveloperLead DeveloperAnd you’ve added the code Leo linked to, along with your post type name?: https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type
April 8, 2018 at 1:28 pm #544748Alessio AngeloroYes, i have tried this
add_filter( 'generate_blog_columns','tu_portfolio_columns' ); function tu_portfolio_columns( $columns ) { if ( is_post_type_archive( 'annunci' ) ) { return true; } return $columns; }
and this
add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); function tu_portfolio_masonry( $masonry ) { if ( is_post_type_archive( 'annunci' ) ) { return 'true'; } return $masonry; }
April 8, 2018 at 9:28 pm #544884TomLead DeveloperLead DeveloperMaybe instead of
is_post_type_archive()
, try:is_tax( 'categoria_annunci' )
April 9, 2018 at 1:36 am #545031Alessio AngeloroThanks! Working ๐
April 9, 2018 at 8:11 am #545363TomLead DeveloperLead DeveloperAwesome! No problem ๐
-
AuthorPosts
- You must be logged in to reply to this topic.