I'm new to WP templating and I'm trying to create my own custom WP theme from a single page bootstrap theme. To My problem is so particular, per say (hoping I don't get yelled at for this), I'm having a hard time finding solutions for my problem.
I am just making a simple theme with a portfolio page. All my files are local as of now. I downloaded a bootstrap theme from here.
The problem I am having is on my portfolio page. I have a custom post type and (I guess) a custom page template loading for this page (not sure if you need to know that, just wanted to ensure you know). All I want to do is click on one of my thumbnails and have blow up and show on the page while making the background dim (like in the original), see the example from the link above.
The css/js lightbox gallery plugin for this is called baguetteBox.js. There doesn't appear to be anything on the internet showing how to WP template this js photo gallery correctly into a custom post way on WP. Below is an example of the two attributes and class that get dynamically added to the bottom div when someone clicks on any of the thumbnail images. What I want to know is how can I implement this functionality from the BS template into my WP template?
But I am not sure if there is a function or functions that helps me implement that so it does the same thing in WP? What's the procedure for implementing that? My respective template files are as follows:
my page-portfolio template
<?php
/*
Template Name: Portfolio layout
*/
?>
<?php get_header(); ?>
<div class="container gallery-container">
<h1 class="headerTitle" > <?php wp_title(); ?> </h1>
<p class="page-description text-center"><?php bloginfo('description'); ?></p>
<div class="tz-gallery">
<div class="row">
<?php
$args = array(
'post_type' => 'portfolio'
);
$query = new WP_Query( $args );
?>
<?php if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<a class="lightbox" href="http://localhost:8888/wordpress_local/wp-content/uploads/2018/01/traffic.jpg">
<?php the_post_thumbnail( 333, 249 ); ?>
</a>
<div class="caption">
<h3><?php the_title(); ?></h3>
<p><?php the_field('editor'); ?></p>
</div>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</div>
</div>
<?php get_footer(); ?>
my header.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title(); ?></title>
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?> >
<!-- Conditional For Edit Menu to Adjust with Logged in Users -->
<?php
if ( is_admin_bar_showing() ) {
echo '<style type="text/css"> .navbar.navbar-inverse.navbar-fixed-top {margin-top: 32px;} </style>';
}
?>
<!-- END Conditional Edit for Logged in Users -->
<div class="navbar navbar-inverse navbar-fixed-top" >
<div class="container">
<div class="navbar-header"> <!-- contains toggle and brand -->
<button class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse" type="button">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="<?php bloginfo('url'); ?>" class="navbar-brand"><?php bloginfo('name'); ?></a>
</div>
<div class="navbar-collapse collapse">
<?php
wp_nav_menu( array(
'theme_location' => 'primary-menu',
'depth' => 2,
'container' => 'div',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'bs-example-navbar-collapse-1',
'menu_class' => 'nav navbar-nav',
'fallback_cb' => 'WP_Bootstrap_Navwalker::fallback',
'walker' => new WP_Bootstrap_Navwalker(),
) );
?>
</div><!--/.nav-collapse -->
</div>
</div>
my footer.php
<?php wp_footer(); ?>
</body>
<!-- script for intiating tz-gallery -->
<script type="text/javascript">
baguetteBox.run('.tz-gallery');
</script>
</html>
<?php get_post_field($context = 'display'); ?>
Any help is appreciated.