april-s
9/4/2014 - 8:49 PM

Asset Depot Plugin - Front-end display code.

Asset Depot Plugin - Front-end display code.

<!--Make sure you wrap your pages inside of a logged-in statement, so not everyone can see. Here are some examples -->

<?php if ( is_user_logged_in() ) {?>
	<?php if (have_rows('ad_page')){?>
     <div class="well">Please note, carousel images will not be displayed in this view.</div>
    <?php while (have_rows('ad_page')){ the_row(); ?>
      <h2><?php the_sub_field('page_title'); ?></h2>
      <h3><?php the_sub_field('page_description'); ?></h3>
      <?php the_sub_field('page_content'); ?>
    <?php }; ?>
<?php }; ?>
<?php } else { ?>
You need to be logged in to view this content
<?php } ;?>

<!-- user is logged in and can edit posts, if you have other roles set for logged in users --> -->
<?php if ( is_user_logged_in() && current_user_can('edit_posts') ) {?>
	<?php if (have_rows('ad_page')){?>
     <div class="well">Please note, carousel images will not be displayed in this view.</div>
    <?php while (have_rows('ad_page')){ the_row(); ?>
      <h2><?php the_sub_field('page_title'); ?></h2>
      <h3><?php the_sub_field('page_description'); ?></h3>
      <?php the_sub_field('page_content'); ?>
    <?php }; ?>
<?php }; ?>
<?php } else { ?>
You need to be logged in to view this content
<?php } ;?>
<!--Use this file if you do not want any carousels to display -->
<?php if (have_rows('ad_page')){?>
 
 <div class="well">Please note, carousel images will not be displayed in this view.</div>
    <?php while (have_rows('ad_page')){ the_row(); ?>
      <h2><?php the_sub_field('page_title'); ?></h2>
      <h3><?php the_sub_field('page_description'); ?></h3>
      <?php the_sub_field('page_content'); ?>
    <?php }; ?>
 
<?php }; ?>
<?php if (have_rows('ad_page')) { ?>
    <?php while (have_rows('ad_page')) {
        the_row();
        ?>
        <h2><?php the_sub_field('page_title'); ?></h2>
        <h3><?php the_sub_field('page_description'); ?></h3>
        <?php the_sub_field('page_content'); ?>
 
        <?php $carousel = get_sub_field('do_you_want_a_carousel'); 
        //this section has been added if you want a carousel to display, and verbiage to display if none is set 
        ?>
 
        <?php if ($carousel == 'Yes') { ?>
            <?php if (have_rows('carousel')) { ?>
                <?php while (have_rows('carousel')) {
                    the_row();
                    ?>
                    <h3>Carousel Name:<?php the_sub_field('carousel_name'); ?></h3>
                    <?php if (have_rows('add_images')) { ?>
                        <?php while (have_rows('add_images')) {
                            the_row();
                            ?>
                            <?php
                            $carouselimage = get_sub_field('image');
                            if (!empty($carouselimage)) {
                                ?>
                                <img src="<?php echo $carouselimage['url']; ?>" alt="<?php echo $carouselimage['alt']; ?>" /> 
                            <?php }; // add_images if empty ?> 
                        <?php }; // add_images while:   ?>
                    <?php }; // add_images if  ?>
                <?php }; // carousel while: ?>
            <?php }; // carousel if ?>
        
        <?php } else {
            ( $carousel == 'No' ) ?>
            <div class="well">No carousels exist.</div>
        <?php }; //end carousel else  ?>
            
    <?php }; // end page while  ?>
<?php }; //end page if ?>