<?php
/**
 * The Footer: widgets area, logo, footer menu and socials
 *
 * @package PANTRY
 * @since PANTRY 1.0
 */

							do_action( 'pantry_action_page_content_end_text' );
							
							// Widgets area below the content
							pantry_create_widgets_area( 'widgets_below_content' );
						
							do_action( 'pantry_action_page_content_end' );
							?>
						</div>
						<?php
						
						do_action( 'pantry_action_after_page_content' );

						// Show main sidebar
						get_sidebar();

						do_action( 'pantry_action_content_wrap_end' );
						?>
					</div>
					<?php

					do_action( 'pantry_action_after_content_wrap' );

					// Widgets area below the page and related posts below the page
					$pantry_body_style = pantry_get_theme_option( 'body_style' );
					$pantry_widgets_name = pantry_get_theme_option( 'widgets_below_page' );
					$pantry_show_widgets = ! pantry_is_off( $pantry_widgets_name ) && is_active_sidebar( $pantry_widgets_name );
					$pantry_show_related = pantry_is_single() && pantry_get_theme_option( 'related_position' ) == 'below_page';
					if ( $pantry_show_widgets || $pantry_show_related ) {
						if ( 'fullscreen' != $pantry_body_style ) {
							?>
							<div class="content_wrap">
							<?php
						}
						// Show related posts before footer
						if ( $pantry_show_related ) {
							do_action( 'pantry_action_related_posts' );
						}

						// Widgets area below page content
						if ( $pantry_show_widgets ) {
							pantry_create_widgets_area( 'widgets_below_page' );
						}
						if ( 'fullscreen' != $pantry_body_style ) {
							?>
							</div>
							<?php
						}
					}
					do_action( 'pantry_action_page_content_wrap_end' );
					?>
			</div>
			<?php
			do_action( 'pantry_action_after_page_content_wrap' );

			// Don't display the footer elements while actions 'full_post_loading' and 'prev_post_loading'
			if ( ( ! pantry_is_singular( 'post' ) && ! pantry_is_singular( 'attachment' ) ) || ! in_array ( pantry_get_value_gp( 'action' ), array( 'full_post_loading', 'prev_post_loading' ) ) ) {
				
				// Skip link anchor to fast access to the footer from keyboard
				?>
				<a id="footer_skip_link_anchor" class="pantry_skip_link_anchor" href="#"></a>
				<?php

				do_action( 'pantry_action_before_footer' );

				// Footer
				$pantry_footer_type = pantry_get_theme_option( 'footer_type' );
				if ( 'custom' == $pantry_footer_type && ! pantry_is_layouts_available() ) {
					$pantry_footer_type = 'default';
				}
				get_template_part( apply_filters( 'pantry_filter_get_template_part', "templates/footer-" . sanitize_file_name( $pantry_footer_type ) ) );

				do_action( 'pantry_action_after_footer' );

			}
			?>

			<?php do_action( 'pantry_action_page_wrap_end' ); ?>

		</div>

		<?php do_action( 'pantry_action_after_page_wrap' ); ?>

	</div>

	<?php do_action( 'pantry_action_after_body' ); ?>

	<?php wp_footer(); ?>

</body>
</html>