Add new page "Kariera"
This commit is contained in:
137
wp-content/themes/brpfinanse/page-378.php
Normal file
137
wp-content/themes/brpfinanse/page-378.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
/**
|
||||
* Page: Kariera
|
||||
* ID: 473
|
||||
*/
|
||||
|
||||
get_header();
|
||||
|
||||
|
||||
$box_empty = get_field('empty');
|
||||
|
||||
$paged = 1;
|
||||
$args = array(
|
||||
'post_type' => 'kariera',
|
||||
'posts_per_page' => get_option('posts_per_page'),
|
||||
'paged' => $paged,
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
);
|
||||
|
||||
$kariera_query = new WP_Query( $args );
|
||||
?>
|
||||
<?php if ( $kariera_query->found_posts > 0 ) : ?>
|
||||
<main id="primary" class="site-main kariera-page">
|
||||
<?php
|
||||
if ($kariera_query->have_posts()) :
|
||||
$kariera_query->the_post();
|
||||
$banner_image = get_the_post_thumbnail_url(get_the_ID(), 'large');
|
||||
$banner_title = get_the_title();
|
||||
$banner_link = get_permalink();
|
||||
?>
|
||||
<div class="box-1 <?php if ( $kariera_query->found_posts = 1 ) : ?>single<?php endif; ?>">
|
||||
<div class="container">
|
||||
<div class="box--wrapper">
|
||||
<div class="box-bg">
|
||||
<img src="<?php echo $banner_image; ?>" alt="">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-1">
|
||||
<?php get_template_part('inc/breadcrumb');?>
|
||||
</div>
|
||||
<div class="col col-2">
|
||||
<div class="box-head">
|
||||
<h2><?php echo $banner_title; ?></h2>
|
||||
</div>
|
||||
<a class="btn_4" href="<?php echo $banner_link; ?>">Czytaj więcej</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $kariera_query->found_posts >= 2 ) : ?>
|
||||
<div class="box-2">
|
||||
<div class="container">
|
||||
<div id="box-posts-list" class="posts-list">
|
||||
<?php
|
||||
if ($kariera_query->have_posts()) :
|
||||
while ($kariera_query->have_posts()) : $kariera_query->the_post();
|
||||
$image = get_the_post_thumbnail_url(get_the_ID(), 'medium');
|
||||
$title = get_the_title();
|
||||
$link = get_permalink();
|
||||
|
||||
get_template_part(
|
||||
'inc/template-article-card', null, [
|
||||
'image' => $image,
|
||||
'title' => $title,
|
||||
'link' => $link
|
||||
]
|
||||
);
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
if ($kariera_query->found_posts > get_option('posts_per_page')) : ?>
|
||||
<div class="posts-more">
|
||||
<a class="btn_3" href="#" id="load-more-posts" data-page="1">
|
||||
Więcej artykułów
|
||||
<span class="loader"></span>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
<?php else : ?>
|
||||
<main id="primary" class="site-main kariera-page">
|
||||
<div class="box-empty">
|
||||
<div class="container">
|
||||
<div class="box--wrapper">
|
||||
<h2><?php echo $box_empty['title'];?></h2>
|
||||
<p><?php echo $box_empty['text'];?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<?php endif; ?>
|
||||
|
||||
<script>
|
||||
jQuery(function ($) {
|
||||
$('#load-more-posts').on('click', function (e) {
|
||||
e.preventDefault()
|
||||
var button = $(this)
|
||||
var page = button.data('page')
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo admin_url("admin-ajax.php"); ?>',
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'load_more_kariera',
|
||||
page: page,
|
||||
},
|
||||
beforeSend: function () {
|
||||
button.prop('disabled', true)
|
||||
button.find('.loader').show()
|
||||
},
|
||||
complete: function () {
|
||||
button.prop('disabled', false)
|
||||
button.find('.loader').hide()
|
||||
},
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
$('#box-posts-list').append(response)
|
||||
button.data('page', page + 1)
|
||||
} else {
|
||||
button.text('Brak więcej artykułów').prop('disabled', true)
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
||||
<?php get_footer();
|
||||
Reference in New Issue
Block a user