Skip to content

Commit

Permalink
check if a part has been loaded already before loading that part
Browse files Browse the repository at this point in the history
fixes #37
  • Loading branch information
jazzsequence committed Aug 17, 2015
1 parent ae7f749 commit 401fcf8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,14 @@ public function add_template_parts( $layout = '', $container = '', $class = '' )
if ( is_array( $parts ) && ! $this->templates_loaded ) {
do_action( 'wds_page_builder_before_load_parts' );
foreach( $parts as $this->parts_index => $part ) {
$this->load_template_part( $part, $container, $class );

// check if the current part was loaded already
if ( ( '' !== $this->get_part() ) && $this->get_part() !== $part['template_group'] ) {

$this->load_template_part( $part, $container, $class );

}

}
do_action( 'wds_page_builder_after_load_parts' );
}
Expand Down

0 comments on commit 401fcf8

Please sign in to comment.