WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] get template part and child theme (3 posts)

  1. martcol
    Member
    Posted 1 year ago #

    I am using The Bootstrap theme as the parent to my child. I want to fiddle with The Loop and I have managed to get my head around get_template_part but it took me a while to realise that it uses a whole series of content.php files to serve different loops for different circumstances.

    I now want to add my own content.php file in my child theme and can't work this out because the files are in a sub-folder in the parent theme folder called "partials"

    The Bootstrap uses this:

    while ( have_posts() ) {
    	the_post();
    	get_template_part( '/partials/content', get_post_format() );
    			}

    I want to use conent-listing.php to pull content from a Custom Post Type. Can someone please help me work this out?

    Thanks

    Martin

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/

    Child themes can override these templates the same as before — the child theme will just need to create the same directory structure to do it. (So, /page-templates/one-column.php needs to be overridden with /page-templates/one-column.php, not /one-column.php.)

  3. martcol
    Member
    Posted 1 year ago #

    Thank you that really helps

Topic Closed

This topic has been closed to new replies.

About this Topic