public static function onGetBarById($id)
 {
     echo $id;
     $bars = new Bars();
     $bars->GetBars($id);
 }
Exemple #2
0
    static function handle_shortcode($atts)
    {
        self::$add_script = true;
        extract(shortcode_atts(array('class' => false, 'pages' => false, 'logos' => true), $atts, 'bars'));
        global $hero;
        //$hero->section_class = "row";
        //$bars =
        if (empty($pages)) {
            $pages = array(91, 89, 95, 97, 101);
            //Youth Pages
        } else {
            $pages = explode(',', $pages);
        }
        // WP_Query arguments
        $args = array('post_type' => 'page', 'post__in' => $pages, 'orderby' => 'date');
        // The Query
        $query = new WP_Query($args);
        //$query->post_count
        $last_post = $query->posts[$query->post_count - 1];
        $hero_color = get_field('page_color', $last_post->ID);
        ob_start();
        ?>
			
	        <div class="container-fluid">

				<div class="row youth-programs" style="<?php 
        if ($hero_color) {
            echo "background:" . $hero_color . ";";
        }
        ?>
">
				            
				  
				            <?php 
        $p = 0;
        if ($query->have_posts()) {
            while ($query->have_posts()) {
                $query->the_post();
                ?>
				            	
				            	<?php 
                $count = $query->post_count;
                $options = custom_options();
                $post_id = get_the_ID();
                $featured = getImage($post_id, '720');
                $logo = $featured;
                if (!empty($options->logo)) {
                    $logo = $options->logo;
                }
                ?>
				            	
				            	<!-- Filler Bar -->
				            	<?php 
                if ($p == 0) {
                    ?>
				            	
						            <div class="filler bar-bar col-md-1 hidden-sm hidden-xs ease" rel="" style="<?php 
                    //BG Color Overlay
                    if (get_field('page_color')) {
                        ?>
background: <?php 
                        echo get_field('page_color');
                        ?>
; <?php 
                        //#000000
                    }
                    ?>
"></div>
						            
					            <?php 
                }
                ?>
								
								
								
					            <!-- bar-bar - <?php 
                the_title();
                ?>
 -->
					            <div class="youth-program bar-bar col-md-2 ease bar-<?php 
                echo $p;
                ?>
" rel="" onclick="location.href='<?php 
                the_permalink();
                ?>
';" style="height: 400px; cursor: pointer; <?php 
                //BG Color Overlay
                if (get_field('page_color')) {
                    ?>
background: <?php 
                    echo get_field('page_color');
                    ?>
; <?php 
                    //#000000
                }
                ?>
">
									
									<?php 
                /* if( !$logos ){ ?>
                				<div class="bar-bg-image ease-opacity">
                					<img src="<?php echo $featured; ?>" alt="<?php the_title(); ?>">
                				</div>
                			<?php } */
                ?>
									
									<div class="bar-content">
										
										<a href="<?php 
                the_permalink();
                ?>
" title="<?php 
                the_title();
                ?>
">
										
							                <div class="center">
							                	
							                    <?php 
                if ($logos) {
                    ?>
							                    	<span class="bar-logo"><img src="<?php 
                    echo $logo;
                    ?>
"></span>
							                    <?php 
                }
                ?>
							                    <h2><?php 
                the_title();
                ?>
</h2>
							                    <div class="hover-info">
								                    <p></p>
							                    </div>
							                	
												<div class="social-icons ease-height">
													<?php 
                echo social_media_profiles();
                ?>
												</div>
												
							                </div>
						                
						                </a>
						                
									</div>
									
					            </div>
				            
				            <?php 
                $p++;
            }
        }
        wp_reset_query();
        //Clear query so nothing weird shows up after loop
        ?>
				            
				            
				
				            
				        <!-- end SECTION -->
				        </div>
				
				</div>

		<?php 
        $content = ob_get_clean();
        return $content;
    }