• Resolved csjWP

    (@csjwp)


    I just need clarification on this.

    As I understand it you should only create a loop in the template/archive file where the get_header(); is and not/(also) in the template_part file.

    My reason for asking is because I have an achieve index page that starts the loop and then query the get_template_part() for the content.

    But in the template-parts file I need to echo the custom taxonomy slug in the div class, so I can filter it with Isotope.

Viewing 1 replies (of 1 total)
  • Hello @csjwp,

    get_header and get_template_part are very similar in nature; basically they include certain PHP files. Including files is convenient to organize your code in a better way or not the repeat the same code over and over.

    get_header by default includes the header.php file and get_template_part( 'file' ) includes the file you specified, in my simplistic example the file.php.

    You can “create” loops in the files which are included.

Viewing 1 replies (of 1 total)
  • The topic ‘Question about the loop and template parts’ is closed to new replies.