Community Forums › Forums › Archived Forums › General Discussion › Custom Post Type Archive Page can't title of page or read more link
Tagged: archive page template, custom loop, Custom Post Type
- This topic has 1 reply, 1 voice, and was last updated 4 years, 5 months ago by asbilly92.
-
AuthorPosts
-
April 6, 2020 at 2:47 pm #497766asbilly92Participant
I have been working on this for a long time. It is served locally so I can't post a link. I'm trying to modify the default CPT archive page/make a custom one. I have made the template, and it is calling most of the wanted things. However, it will not pull in the title of the page no matter what I do. I even added support for content archive intro settings; which is also showing in the dashboard; not on the front end tho.
I don't even want anything special, just to be able to state the page name and some intro text before the loop starts. I was also unable to call the 'read-more' link after the do_action( 'genesis_entry_footer') (that part is removed at the moment)
Any help appreciated! Thank you!
What am I doing wrong... here is my code for the CPT archive page:
http://n/a<?php /** * Template Name: Sales Horses Archives * Description: Used as a page template to show page contents, followed by a loop through a CPT archive */ //* Remove the action that automatically outputs the headline and intro-text remove_action( 'genesis_before_loop', 'genesis_do_cpt_archive_title_description' ); //* Custom output add_action( 'genesis_before_loop', 'rv_cpt_archive_title_description' ); function rv_cpt_archive_title_description() { /** * Genesis stores the archive settings in an option (array) named genesis-cpt-archive-settings-{post_type} * This example uses a custom post type called 'sale horses' */ $archive_settings = get_option( 'genesis-cpt-archive-settings-service' ); echo $archive_settings['headline']; echo $archive_settings['intro_text']; } /** Replace the home loop with our custom loop**/ remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'holland_custom_loop' ); /** Custom loop **/ function holland_custom_loop() { if ( have_posts() ) : do_action( 'genesis_before_while' ); while ( have_posts() ) : the_post(); do_action( 'genesis_before_entry' ); printf( '<article %s>', genesis_attr( 'entry' ) ); do_action( 'genesis_entry_header' ); do_action( 'genesis_before_entry_content' ); printf( '<div %s>', genesis_attr( 'entry-content' ) ); //do_action( 'genesis_entry_content' ); //Remove standard excerpt echo genesis_do_post_image(); //Add in featured image echo '</div>'; do_action( 'genesis_after_entry_content' ); do_action( 'genesis_entry_footer' ); echo '</article>'; do_action( 'genesis_after_entry' ); endwhile; //* end of one post do_action( 'genesis_after_endwhile' ); else : //* if no posts exist do_action( 'genesis_loop_else' ); endif; //* end loop } genesis();
April 7, 2020 at 5:21 am #497792asbilly92ParticipantSorry, my title should read: Custom Post Type Archive Page not pulling title of page or read more link. Too tired when I posted that!
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.