Last active
August 29, 2015 14:06
-
-
Save aibrean/3bdb72d9602270b4dff0 to your computer and use it in GitHub Desktop.
Asset Depot Plugin - Front-end display code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--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 }; ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--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 } ;?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment