Skip to content

Commit

Permalink
Tutorials section added
Browse files Browse the repository at this point in the history
  • Loading branch information
edrisranjbar committed Oct 13, 2021
1 parent 6809195 commit aa2769e
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 57 deletions.
65 changes: 50 additions & 15 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -410,32 +410,67 @@ header {

/* Tutorials Section */
.tutorials {
margin-top: -417px;
margin-top: -600px;
padding-top: 185px;
padding-right: 40px;
margin-bottom: 102px;
background: linear-gradient(90deg, #7C96F7 0%, #6C63FF 100%);
background-image: url('../images/Tutorials.png');
background-size: contain;
background-repeat: no-repeat;
min-height: 800px;
}

.tutorials .wrapper {
display: flex;
overflow-x: auto;
overflow-y: hidden;
margin-right: 78px;
.tutorial {
width: 350px;
background: #F0F0F0;
box-shadow: 0px 10px 40px rgba(50, 45, 45, 0.25);
border-radius: 10px;
margin-left: 20px;
}

.tutorials img {
width: 339px;
border-radius: 30px;
margin-left: 51px;
.tutorial .thumbnail{
margin: 8px;
}
.tutorial .thumbnail img{
width: 100%;
height: 200px;
border-radius: 5px;
}
.tutorial .row{
width: 100%;
display: flex;
justify-content: space-between;
}

.tutorials .title {
font-size: 40px;
font-weight: bold;
text-align: center;
text-align: right;
color: var(--white);
margin-bottom: 40px;
}
.tutorial_body{
margin-left: 8px;
margin-right: 8px;
}
.price_tag{
font-style: normal;
font-weight: 700;
font-size: 16px;
line-height: 25px;
text-align: right;
color: #6C63FF;
margin-bottom: 16px;
}
.tutorial_title{
color: var(--dark);
font-style: normal;
font-weight: bold;
font-size: 24px;
line-height: 37px;
text-align: right;
margin: 8px 0px 8px 0;
}

/* End Tutorials Section */

/* Podcasts Page */
.podcasts {
padding: 0px 45px;
Expand Down
Binary file added assets/images/Tutorials.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ function JetCode_register_styles()
function JetCode_register_scripts()
{
$version = wp_get_theme()->get('Version');
wp_enqueue_script('JetCode_script', get_template_directory_uri() . "/assets/js/script.js", ['JetCode_more_posts_loader_script', 'JetCode_glider_script', 'JetCode_swipe_script'], $version, true);
wp_enqueue_script('JetCode_script', get_template_directory_uri() . "/assets/js/script.js", ['JetCode_more_posts_loader_script', 'JetCode_glider_script', 'JetCode_swipe_script','JetCode_like_script'], $version, true);
wp_enqueue_script('JetCode_like_script', get_template_directory_uri() . "/assets/js/like.js", [], '1.0', true);
wp_enqueue_script('JetCode_glider_script', get_template_directory_uri() . "/assets/js/glider.min.js", [], '1.0', true);
wp_enqueue_script('JetCode_swipe_script', get_template_directory_uri() . "/assets/js/swipe.js", [], '1.0', true);
wp_enqueue_script('JetCode_more_posts_loader_script', get_template_directory_uri() . "/assets/js/more_posts_loader.js", [], $version, true);
Expand Down
42 changes: 1 addition & 41 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,46 +64,6 @@
<a href="<?php echo JetCode_get_theme_option('hero_first_link'); ?>" class="btn btn-secondary">رفتن به وبلاگ</a>
</div>
</section>
<section class="tutorials">
<h3 class="title">دوره های آموزشی</h3>
<div class="glider-contain">
<div class="glider">
<?php
$args = array(
'post_type' => 'tutorial'
);
$query = new WP_Query($args);
// The Loop
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$post_id = $query->get_the_ID();
?>
<a href="<?php echo get_the_permalink(); ?>">
<div class="slide">
<?php if (has_post_thumbnail($post_id)) {
$thumbnail = get_the_post_thumbnail_url($post_id);
} else {
$thumbnail = get_template_directory_uri() . "/assets/images/no-thumbnail.png";
} ?>

<img src="<?php echo $thumbnail; ?>" alt="<?php echo get_the_title(); ?>">
</div>
</a>
<?php
}
} else {
// no tutorial found
echo "<h3 class='text-center text-orange m-0'>دوره ای یافت نشد</h3>";
}
/* Restore original Post Data */
wp_reset_postdata();
?>
</div>
<div class="">
<div role="tablist" class="dots"></div>
</div>
</div>
</section>
<?php get_template_part('tutorials'); ?>
</main>
<?php get_footer(); ?>
45 changes: 45 additions & 0 deletions tutorials.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<section class="tutorials">
<h2 class="title">دوره های آموزشی</h2>
<div class="row">
<?php
$args = array(
'post_type' => 'tutorial'
);
$query = new WP_Query($args);
// The Loop
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$post_id = $query->get_the_ID();
?>
<div class="tutorial">
<div class="thumbnail">
<a href="<?php echo get_the_permalink(); ?>">
<?php if (has_post_thumbnail($post_id)) {
$thumbnail = get_the_post_thumbnail_url($post_id);
} else {
$thumbnail = get_template_directory_uri() . "/assets/images/no-thumbnail.png";
} ?>
<img src="<?php echo $thumbnail; ?>" alt="<?php echo get_the_title(); ?>">
</a>
</div>
<div class="tutorial_body">
<a href="<?php echo get_the_permalink(); ?>">
<h2 class="tutorial_title"><?php echo get_the_title(); ?></h2>
</a>
<div class="row">
<span class="price_tag">11,300 تومان</span>
</div>
</div>
</div>
<?php
}
} else {
// no tutorial found
echo "<h3 class='text-center text-orange m-0'>دوره ای یافت نشد</h3>";
}
/* Restore original Post Data */
wp_reset_postdata();
?>
</div>
</section>

0 comments on commit aa2769e

Please sign in to comment.