Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCarla Thomas
Front End Web Development Techdegree Student 16,039 PointsAdvanced WP-Bootstrap: Where would I place the JS Modal code inside WordPress index.php for Responsive Photo Gallery?
I am creating a responsive photo gallery using Bootstrap.
Here is the JS Modal code:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
Please see my coding below and tell me if the code has been placed correctly. If not, where should it be placed? Thanks in adavance.
<?php
/**
* Main Template File
*
* This file is used to display a page when nothing more specific matches a query.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package Duvalls_beta_tester
*/
?>
<?php get_header(); ?>
<div class="container">
<div>
<?php
$args = array('post_type' => 'profiles');
$query = new WP_Query($args);
while($query -> have_posts()): $query -> the_post();
?>
<div class="profile row">
<div class="col-md-2">
<?php echo(types_render_field( "profile-picture", array( "alt" => "blue bird", "width" => "140", "height" => "140", "proportional" => "true" ) )); ?>
</div>
<div class="col-md-10">
<h4><p><?php echo(types_render_field( "user-name", array( ) )); ?></p></h4>
<p><?php echo(types_render_field( "user-profile", array( ) )); ?></p>
</div>
</div>
<div class=".container-gallery">
<ul class="row">
// gallery photos inside <li></li> are here
</ul>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<?php endwhile; ?>
<div class="row">
<?php get_footer(); ?>
</div>
</div>
1 Answer
Zac Gordon
Treehouse Guest TeacherHi Carla, Did you get this working?
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsNo, it's not working yet.
I found your video on Bootstrap Modals...I'm sure you have provided the answer there.
Carla Thomas
Front End Web Development Techdegree Student 16,039 PointsCarla Thomas
Front End Web Development Techdegree Student 16,039 PointsAfter a little research, I learned that I must wrap the Bootstrap JS Modal code around each gallery photo.