Advertisement
Guest User

yummy-pro-child-customization

a guest
Aug 15th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.74 KB | None | 0 0
  1. function yummy_pro_menu_page_first_section() {
  2.         $options = yummy_pro_get_theme_options();
  3.  
  4.         $content_type = $options['menu_first_section_content_type'];
  5.         $args = array();
  6.         $cat_id = '';
  7.         switch ( $content_type ) {
  8.             case 'category':
  9.                 $cat_id = ! empty( $options['menu_first_section_content_category'] ) ?$options['menu_first_section_content_category'] : '';
  10.                 if ( ! empty( $cat_id ) ) :
  11.                     $args = array(
  12.                         'post_type' => 'post',
  13.                         'cat'       => $cat_id,
  14.                         'posts_per_page' => 20,
  15.                         );
  16.                 endif;
  17.             break;
  18.  
  19.             case 'woo-category':
  20.                 $cat_id = ! empty( $options['menu_first_section_content_woo_category'] ) ?$options['menu_first_section_content_woo_category'] : '';
  21.                 if ( ! empty( $cat_id ) ) :
  22.                     $args = array(
  23.                         'post_type' => 'product',
  24.                         'posts_per_page' => 20,
  25.                         'tax_query' => array(
  26.                             array(
  27.                                 'taxonomy'  => 'product_cat',
  28.                                 'field'     => 'id',
  29.                                 'terms'     => $cat_id,
  30.                             ) ),
  31.                         );
  32.                 endif;
  33.             break;
  34.         }
  35.  
  36.         if ( empty( $args ) ) {
  37.             return;
  38.         }
  39.  
  40.         $posts = get_posts( $args );
  41.         ?>
  42.         <section id="todays-menu" class="page-section today-menu-list">
  43.             <div class="wrapper">
  44.                 <?php if ( ! empty( $options['menu_first_section_title'] ) ) : ?>
  45.                     <header class="entry-header align-center"> 
  46.                         <h2 class="entry-title entry-title-separator"><?php echo esc_html( $options['menu_first_section_title'] ); ?></h2>
  47.                     </header><!-- .entry-header -->
  48.                 <?php endif; ?>
  49.  
  50.                 <div class="entry-content">
  51.                     <div class="food-item-list clear">
  52.                         <div class="list-items">
  53.                             <div class="food-item-list-wrapper">
  54.                                 <?php foreach( $posts as $post ) : ?>
  55.                                     <div class="menu-list">
  56.                                         <h5><a href="<?php the_permalink( $post->ID ); ?>"><?php echo esc_html( $post->post_title ); ?></a></h5>
  57.                                         <p><?php echo esc_html( yummy_pro_trim_content( 20, $post ) ); ?></p>
  58.                                         <?php
  59.                                         $tag = ( $content_type == 'woo-category' ) ? 'product_tag' : 'post_tag';
  60.                                         $tags = get_the_terms( $post->ID, $tag );
  61.                                         if ( ! empty( $tags ) ) :
  62.                                             foreach ( $tags as $tag ) : ?>
  63.                                                 <a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>" class="more-link small-btn order-item"><?php echo esc_html( $tag->name ); ?></a>
  64.                                             <?php endforeach;
  65.                                         endif;
  66.                                         if ( $content_type == 'woo-category' ) : ?>
  67.                                             <span class="price">
  68.                                                 <?php  
  69.                                                 $product = new WC_Product( $post->ID );
  70.                                                 echo $product->get_price_html();
  71.                                                 ?>
  72.                                             </span>
  73.                                         <?php endif; ?>
  74.                                     </div><!--.menu-list-->
  75.                                 <?php endforeach; ?>
  76.                             </div><!-- .food-item-list-wrapper -->
  77.                         </div><!-- .list-items -->
  78.                     </div><!-- .food-item-list -->
  79.                 </div><!-- .entry-content -->
  80.             </div><!-- .wrapper -->
  81.  
  82.             <div class="page-decoration">
  83.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-01.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  84.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-02.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  85.             </div><!-- .page-decoration -->
  86.         </section><!-- #todays-menu -->
  87.     <?php }
  88.  
  89.  
  90.  
  91.     function yummy_pro_menu_page_second_section() {
  92.         $options = yummy_pro_get_theme_options();
  93.         $header_background = ! empty( $options['menu_second_section_image'] ) ? $options['menu_second_section_image'] : get_template_directory_uri() . '/assets/uploads/breakfast.jpg';
  94.         $header_title = ! empty( $options['menu_second_section_title'] ) ? $options['menu_second_section_title'] : '';
  95.         $content_type = $options['menu_second_section_content_type'];
  96.         $args = array();
  97.         $cat_id = '';
  98.         switch ( $content_type ) {
  99.             case 'category':
  100.                 $cat_id = ! empty( $options['menu_second_section_content_category'] ) ?$options['menu_second_section_content_category'] : '';
  101.                 if ( ! empty( $cat_id ) ) :
  102.                     $args = array(
  103.                         'post_type' => 'post',
  104.                         'cat'       => $cat_id,
  105.                         'posts_per_page' => 20,
  106.                         );
  107.                 endif;
  108.             break;
  109.  
  110.             case 'woo-category':
  111.                 $cat_id = ! empty( $options['menu_second_section_content_woo_category'] ) ?$options['menu_second_section_content_woo_category'] : '';
  112.                 if ( ! empty( $cat_id ) ) :
  113.                     $args = array(
  114.                         'post_type' => 'product',
  115.                         'posts_per_page' => 20,
  116.                         'tax_query' => array(
  117.                             array(
  118.                                 'taxonomy'  => 'product_cat',
  119.                                 'field'     => 'id',
  120.                                 'terms'     => $cat_id,
  121.                             ) ),
  122.                         );
  123.                 endif;
  124.             break;
  125.         }
  126.  
  127.         if ( empty( $args ) ) {
  128.             return;
  129.         }
  130.  
  131.         $posts = get_posts( $args );
  132.         ?>
  133.         <section id="breakfast-cover" class="parallax" style="background-image:url('<?php echo esc_url( $header_background ); ?>');" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="0">
  134.             <div class="black-overlay"></div>
  135.             <div class="wrapper">
  136.                 <?php if ( ! empty( $header_title ) ) : ?>
  137.                     <header class="entry-header">
  138.                         <h2 class="entry-title color-white"><?php echo esc_html( $header_title ); ?></h2>
  139.                     </header>
  140.                 <?php endif; ?>
  141.             </div><!--.wrapper-->
  142.         </section><!-- #breakfast-cover -->
  143.  
  144.         <section id="breakfast" class="col-2 food-item">
  145.             <div class="wrapper">
  146.                 <div class="breakfast-item add-shadow">
  147.                     <div class="row no-margin">
  148.                         <?php
  149.                         $i = 1;
  150.                         foreach ( $posts as $post ) : ?>
  151.                             <div class="column-wrapper">
  152.                                 <div class="recipe-list">
  153.                                     <h4 class="color-black"><a href="<?php the_permalink( $post->ID ); ?>"><?php echo esc_html( $post->post_title ); ?></a></h4>
  154.                                     <p><?php echo esc_html( yummy_pro_trim_content( 8, $post ) ); ?></p>
  155.                                     <?php if ( 'woo-category' == $content_type ) : ?>
  156.                                         <span><?php esc_html_e( 'Price', 'yummy-pro' ); ?> <span class="price">
  157.                                             <?php  
  158.                                             $product = new WC_Product( $post->ID );
  159.                                             echo $product->get_price_html();
  160.                                             ?>
  161.                                         </span></span>
  162.                                     <?php endif;
  163.                                     $tag = ( $content_type == 'woo-category' ) ? 'product_tag' : 'post_tag';
  164.                                     $tags = get_the_terms( $post->ID, $tag );
  165.                                     if ( ! empty( $tags ) ) :
  166.                                         foreach ( $tags as $tag ) : ?>
  167.                                             <a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>" class="more-link small-btn"><?php echo esc_html( $tag->name ); ?></a>
  168.                                         <?php endforeach;
  169.                                     endif;
  170.                                     ?>
  171.                                 </div><!--.recipe-list-->
  172.                                 <div class="featured-image">
  173.                                     <?php  
  174.                                     if ( has_post_thumbnail( $post->ID ) ) {
  175.                                         $image_url = get_the_post_thumbnail_url( $post->ID, 'post-thumbnail' );
  176.                                     } else {
  177.                                         $image_url = get_template_directory_uri() . '/assets/uploads/no-featured-image-300x300.jpg';
  178.                                     }
  179.                                     ?>
  180.                                     <a href="<?php the_permalink( $post->ID ); ?>"><img src="<?php echo esc_url( $image_url ); ?>"></a>
  181.                                 </div><!--.featured-image-->
  182.                             </div><!--.column-wrapper-->
  183.                             <?php if ( $i % 2 == 0 ) : ?>
  184.                                 </div>
  185.                                 <div class="row no-margin">
  186.                             <?php endif;
  187.                             $i++;
  188.                         endforeach; ?>
  189.                     </div><!--.row-->
  190.                 </div><!--.breakfast-item-->
  191.             </div><!-- .wrapper -->
  192.  
  193.             <div class="page-decoration">
  194.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-03.jpg" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  195.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-04.jpg" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  196.             </div><!-- .page-decoration -->
  197.         </section><!-- #breakfast -->
  198.     <?php }
  199.  
  200.  
  201.     function yummy_pro_menu_page_third_section() {
  202.         $options = yummy_pro_get_theme_options();
  203.         $header_background = ! empty( $options['menu_third_section_image'] ) ? $options['menu_third_section_image'] : get_template_directory_uri() . '/assets/uploads/lunch.jpg';
  204.         $header_title = ! empty( $options['menu_third_section_title'] ) ? $options['menu_third_section_title'] : '';
  205.         $header_subtitle = ! empty( $options['menu_third_section_sub_title'] ) ? $options['menu_third_section_sub_title'] : '';
  206.         $content_type = $options['menu_third_section_content_type'];
  207.         $args = array();
  208.         $cat_id = '';
  209.         switch ( $content_type ) {
  210.             case 'category':
  211.                 $cat_id = ! empty( $options['menu_third_section_content_category'] ) ?$options['menu_third_section_content_category'] : '';
  212.                 if ( ! empty( $cat_id ) ) :
  213.                     $args = array(
  214.                         'post_type' => 'post',
  215.                         'cat'       => $cat_id,
  216.                         'posts_per_page' => 20,
  217.                         );
  218.                 endif;
  219.             break;
  220.  
  221.             case 'woo-category':
  222.                 $cat_id = ! empty( $options['menu_third_section_content_woo_category'] ) ?$options['menu_third_section_content_woo_category'] : '';
  223.                 if ( ! empty( $cat_id ) ) :
  224.                     $args = array(
  225.                         'post_type' => 'product',
  226.                         'posts_per_page' => 20,
  227.                         'tax_query' => array(
  228.                             array(
  229.                                 'taxonomy'  => 'product_cat',
  230.                                 'field'     => 'id',
  231.                                 'terms'     => $cat_id,
  232.                             ) ),
  233.                         );
  234.                 endif;
  235.             break;
  236.         }
  237.  
  238.         if ( empty( $args ) ) {
  239.             return;
  240.         }
  241.  
  242.         $posts = get_posts( $args );
  243.         ?>
  244.         <section id="lunch-cover" class="parallax" style="background-image:url('<?php echo esc_url( $header_background ); ?>');" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="0">
  245.             <div class="black-overlay"></div>
  246.             <div class="wrapper">
  247.                 <?php if ( ! empty( $header_title ) ) : ?>
  248.                     <header class="entry-header">
  249.                         <h2 class="entry-title color-white"><?php echo esc_html( $header_title ); ?></h2>
  250.                     </header>
  251.                 <?php endif; ?>
  252.             </div><!--.wrapper-->
  253.         </section><!-- #lunch-cover -->
  254.  
  255.         <section id="lunch">
  256.             <div class="wrapper">
  257.                 <div class="lunch-details add-shadow">
  258.                     <img class="fruit" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/fruit-1.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  259.                     <img class="fruit-1" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/fruit.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  260.                     <?php if ( ! empty( $header_subtitle ) ) : ?>
  261.                         <header class="entry-header">
  262.                             <h2 class="entry-title"><?php echo esc_html( $header_subtitle ); ?></h2>
  263.                             <div class="separator"></div>
  264.                         </header><!--.entry-header-->
  265.                     <?php endif; ?>
  266.  
  267.                     <div class="entry-content col-2 food-item">
  268.                         <?php foreach ( $posts as $post ) : ?>
  269.                             <div class="lunch-menu">
  270.                                 <h5 class="color-black"><a href="<?php echo the_permalink( $post->ID ); ?>"><?php echo esc_html( $post->post_title ); ?></a></h5>
  271.                                 <?php  
  272.                                 $tag = ( $content_type == 'woo-category' ) ? 'product_tag' : 'post_tag';
  273.                                 $tags = get_the_terms( $post->ID, $tag );
  274.                                 if ( ! empty( $tags ) ) :
  275.                                     foreach ( $tags as $tag ) : ?>
  276.                                         <a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>" class="more-link small-btn"><?php echo esc_html( $tag->name ); ?></a>
  277.                                     <?php endforeach;
  278.                                 endif;
  279.                                 ?>
  280.                                 <p><?php echo esc_html( yummy_pro_trim_content( 14, $post ) ); ?></p>
  281.                                 <?php if ( 'woo-category' == $content_type ) : ?>
  282.                                     <span><?php esc_html_e( 'Price', 'yummy-pro' ); ?> <span class="price">
  283.                                         <?php  
  284.                                         $product = new WC_Product( $post->ID );
  285.                                         echo $product->get_price_html();
  286.                                         ?>
  287.                                     </span></span>
  288.                                 <?php endif; ?>
  289.                             </div><!--.lunch-menu-->
  290.                         <?php endforeach; ?>
  291.                     </div><!-- .entry-content -->
  292.                 </div><!--.lunch-details-->
  293.             </div><!--.wrapper-->
  294.  
  295.             <div class="page-decoration">
  296.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-05.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  297.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-06.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  298.             </div><!-- .page-decoration -->
  299.         </section><!-- #lunch -->
  300.     <?php }
  301.  
  302.     function yummy_pro_menu_page_fourth_section() {
  303.         $options = yummy_pro_get_theme_options();
  304.         $header_background = ! empty( $options['menu_forth_section_image'] ) ? $options['menu_forth_section_image'] : get_template_directory_uri() . '/assets/uploads/dinner.jpg';
  305.         $header_title = ! empty( $options['menu_forth_section_title'] ) ? $options['menu_forth_section_title'] : '';
  306.         $content_type = $options['menu_forth_section_content_type'];
  307.         $args = array();
  308.         $cat_id = '';
  309.         switch ( $content_type ) {
  310.             case 'category':
  311.                 $cat_id = ! empty( $options['menu_forth_section_content_category'] ) ?$options['menu_forth_section_content_category'] : '';
  312.                 if ( ! empty( $cat_id ) ) :
  313.                     $args = array(
  314.                         'post_type' => 'post',
  315.                         'cat'       => $cat_id,
  316.                         'posts_per_page' => 20,
  317.                         );
  318.                 endif;
  319.             break;
  320.  
  321.             case 'woo-category':
  322.                 $cat_id = ! empty( $options['menu_forth_section_content_woo_category'] ) ?$options['menu_forth_section_content_woo_category'] : '';
  323.                 if ( ! empty( $cat_id ) ) :
  324.                     $args = array(
  325.                         'post_type' => 'product',
  326.                         'posts_per_page' => 20,
  327.                         'tax_query' => array(
  328.                             array(
  329.                                 'taxonomy'  => 'product_cat',
  330.                                 'field'     => 'id',
  331.                                 'terms'     => $cat_id,
  332.                             ) ),
  333.                         );
  334.                 endif;
  335.             break;
  336.         }
  337.  
  338.         if ( empty( $args ) ) {
  339.             return;
  340.         }
  341.  
  342.         $posts = get_posts( $args );
  343.         ?>
  344.         <section id="dinner-cover" class="parallax" style="background-image:url('<?php echo esc_url( $header_background ); ?>');" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="0">
  345.             <div class="black-overlay"></div>
  346.             <div class="wrapper">
  347.                 <?php if ( ! empty( $header_title ) ) : ?>
  348.                     <header class="entry-header">
  349.                         <h2 class="entry-title color-white"><?php echo esc_html( $header_title ); ?></h2>
  350.                     </header>
  351.                 <?php endif; ?>
  352.             </div><!--.wrapper-->
  353.         </section><!-- #dinner-cover -->
  354.         <section id="todays-menu" class="page-section today-menu-list dinner-menu-items">
  355.             <div class="wrapper">
  356.                 <div class="entry-content">
  357.                     <div class="food-item-list clear">
  358.                         <div class="list-items">
  359.                             <div class="food-item-list-wrapper">
  360.                                 <?php foreach( $posts as $post ) : ?>
  361.                                     <div class="menu-list">
  362.                                         <h5><a href="<?php the_permalink( $post->ID ); ?>"><?php echo esc_html( $post->post_title ); ?></a></h5>
  363.                                         <p><?php echo esc_html( yummy_pro_trim_content( 10, $post ) ); ?></p>
  364.                                         <?php
  365.                                         $tag = ( $content_type == 'woo-category' ) ? 'product_tag' : 'post_tag';
  366.                                         $tags = get_the_terms( $post->ID, $tag );
  367.                                         if ( ! empty( $tags ) ) :
  368.                                             foreach ( $tags as $tag ) : ?>
  369.                                                 <a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>" class="more-link small-btn order-item"><?php echo esc_html( $tag->name ); ?></a>
  370.                                             <?php endforeach;
  371.                                         endif;
  372.                                         if ( $content_type == 'woo-category' ) : ?>
  373.                                             <span class="price">
  374.                                                 <?php  
  375.                                                 $product = new WC_Product( $post->ID );
  376.                                                 echo $product->get_price_html();
  377.                                                 ?>
  378.                                             </span>
  379.                                         <?php endif; ?>
  380.                                     </div><!--.menu-list-->
  381.                                 <?php endforeach; ?>
  382.                             </div><!-- .food-item-list-wrapper -->
  383.                         </div><!-- .list-items -->
  384.                     </div><!-- .food-item-list -->
  385.                 </div><!-- .entry-content -->
  386.             </div><!-- .wrapper -->
  387.  
  388.             <div class="page-decoration">
  389.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-07.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  390.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-08.png" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  391.             </div><!-- .page-decoration -->
  392.         </section><!-- #todays-menu -->
  393.     <?php }
  394.  
  395.  
  396.     function yummy_pro_menu_page_fifth_section() {
  397.         $options = yummy_pro_get_theme_options();
  398.         $header_background = ! empty( $options['menu_fifth_section_image'] ) ? $options['menu_fifth_section_image'] : get_template_directory_uri() . '/assets/uploads/drinks.jpg';
  399.         $header_title = ! empty( $options['menu_fifth_section_title'] ) ? $options['menu_fifth_section_title'] : '';
  400.         $content_type = $options['menu_fifth_section_content_type'];
  401.         $args = array();
  402.         $cat_id = '';
  403.         switch ( $content_type ) {
  404.             case 'category':
  405.                 $cat_ids = array();
  406.                 if ( !empty( $options['menu_fifth_section_content_category'] ) ) {
  407.                     $cat_ids = $options['menu_fifth_section_content_category'];
  408.                 }
  409.                
  410.                 if ( ! empty( $cat_ids ) ) :
  411.                     foreach( $cat_ids as $cat_id ) :
  412.                         $args[] = array(
  413.                             'post_type'     => 'post',
  414.                             'cat'           => $cat_id,
  415.                             'posts_per_page'=> 20,
  416.                         );
  417.                     endforeach;
  418.                 endif;
  419.             break;
  420.  
  421.             case 'woo-category':
  422.                 $cat_ids = array();
  423.                 if ( !empty( $options['menu_fifth_section_content_woo_category'] ) ) {
  424.                     $cat_ids = $options['menu_fifth_section_content_woo_category'];
  425.                 }
  426.                 if ( ! empty( $cat_ids ) ) :
  427.                     foreach( $cat_ids as $cat_id ) :
  428.                     $args[] = array(
  429.                         'post_type' => 'product',
  430.                         'posts_per_page' => 20,
  431.                         'tax_query' => array(
  432.                             array(
  433.                                 'taxonomy'  => 'product_cat',
  434.                                 'field'     => 'id',
  435.                                 'terms'     => $cat_id,
  436.                             ) ),
  437.                         );
  438.                     endforeach;
  439.                 endif;
  440.             break;
  441.         }
  442.  
  443.         if ( empty( $args ) ) {
  444.             return;
  445.         }
  446.         ?>
  447.         <section id="drink-cover" class="parallax" style="background-image:url('<?php echo esc_url( $header_background ); ?>');" data-stellar-background-ratio="0.5" data-stellar-vertical-offset="0">
  448.             <div class="black-overlay"></div>
  449.             <div class="wrapper">
  450.                 <?php if ( ! empty( $header_title ) ) : ?>
  451.                     <header class="entry-header">
  452.                         <h2 class="entry-title color-white"><?php echo esc_html( $header_title ); ?></h2>
  453.                     </header>
  454.                 <?php endif; ?>
  455.             </div><!--.wrapper-->
  456.         </section><!-- #drink-cover -->
  457.         <section id="drinks-content" class="food-item page-section">
  458.             <div class="wrapper">
  459.                 <div class="col-2">
  460.                     <div class="column-wrapper">
  461.                         <div class="drink-menu">
  462.                             <img class="nuts" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/nuts.png" alt="<?php esc_attr_e( 'Decoration','yummy-pro' ); ?>">
  463.                             <img class="nuts-1" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/nuts-1.png" alt="<?php esc_attr_e( 'Decoration','yummy-pro' ); ?>">
  464.                             <img class="flower" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/flower.png" alt="<?php esc_attr_e( 'Decoration','yummy-pro' ); ?>">
  465.                             <img class="flower-1" src="<?php echo get_template_directory_uri(); ?>/assets/uploads/flower-1.png" alt="<?php esc_attr_e( 'Decoration','yummy-pro' ); ?>">                            
  466.                             <?php
  467.                             $fifth_menu_page_title = $options['fifth_section_title'];
  468.                             $fifth_menu_page_subtitle = $options['fifth_section_subtitle'];
  469.  
  470.                             if( ! empty( $fifth_menu_page_title ) || ! empty( $fifth_menu_page_subtitle ) ) : ?>
  471.                                 <header class="entry-header">
  472.                                     <?php if ( ! empty( $fifth_menu_page_title ) ) : ?>
  473.                                         <h2 class="entry-title"><?php echo esc_html( $fifth_menu_page_title ); ?></h2>
  474.                                     <?php endif;
  475.                                     if ( ! empty( $fifth_menu_page_subtitle ) ) : ?>
  476.                                         <p class="title-desc"><?php echo esc_html( $fifth_menu_page_subtitle ); ?></p>
  477.                                     <?php endif; ?>
  478.                                 </header><!-- .entry-header -->
  479.                             <?php endif; ?>        
  480.                             <div class="entry-content" style="background-image:url('<?php echo get_template_directory_uri() .'/assets/uploads/drink-menu.png'; ?>');">
  481.                                 <?php if( 'category' == $options['menu_fifth_section_content_type'] ) {
  482.  
  483.                                     $fifth_menu_categories_id = ! empty( $options['menu_fifth_section_content_category'] ) ? $options['menu_fifth_section_content_category'] : '';
  484.                                     $fifth_menu_categories_id = ! empty( $fifth_menu_categories_id ) ? $fifth_menu_categories_id : array(); ?>
  485.                                     <ul class="nav-tabs">
  486.                                         <?php foreach ( $fifth_menu_categories_id as $key => $category_id ) {
  487.                                             $category_object = get_category( $category_id );
  488.                                             echo '<li><a href="#'. esc_attr( $category_object->slug ) .'">'. esc_html( $category_object->name ) .'</a></li>';
  489.                                         } ?>
  490.                                     </ul>
  491.                                 <?php } else {
  492.                                     $fifth_menu_categories_id = ! empty( $options['menu_fifth_section_content_woo_category'] ) ? $options['menu_fifth_section_content_woo_category'] : '';
  493.                                     $fifth_menu_categories_id = ! empty( $fifth_menu_categories_id ) ? $fifth_menu_categories_id : array(); ?>
  494.                                     <ul class="nav-tabs">
  495.                                         <?php
  496.                                         $zindex = 1;
  497.                                         foreach ( $fifth_menu_categories_id as $key => $category_id ) {
  498.                                             $category_object = get_term_by( 'id', $category_id, 'product_cat', '' );
  499.                                             $active_class = ( 1 == $zindex ) ? 'active' : '';
  500.                                             $zindex++;
  501.                                             echo '<li class="' . esc_attr( $active_class ) . '"><a href="#'. esc_attr( $category_object->slug ) .'">'. esc_html( $category_object->name ) .'</a></li>';
  502.                                         } ?>
  503.                                     </ul>
  504.                                 <?php } ?>                             
  505.                             </div><!--.entry-content-->
  506.                         </div><!--.drink-menu-->
  507.                     </div><!--.column-wrapper-->
  508.                     <?php $index = 0; ?>
  509.                     <div class="column-wrapper">
  510.                         <div class="drink-list">
  511.                         <?php foreach ( $args as $arg ) :
  512.                             $add_class_active = ( 0 === $index ) ? 'active' : ''; ?>
  513.                             <div id="<?php echo esc_attr( yummy_pro_cat_slug( $cat_ids[$index] ) ) ?>" class="tab-pane <?php echo esc_attr( $add_class_active ); ?>">
  514.                                 <?php $posts = get_posts( $arg );
  515.                                 foreach ( $posts as $post ) { ?>
  516.                                     <div class="post-content">
  517.                                         <div class="image-wrapper">
  518.                                             <a href="<?php the_permalink( $post->ID ); ?>">
  519.                                             <?php if ( has_post_thumbnail( $post->ID ) ) {
  520.                                                 $image_url = get_the_post_thumbnail_url( $post->ID, 'thumbnail' );
  521.                                             } else {
  522.                                                 $image_url = get_template_directory_uri() . '/assets/uploads/no-featured-image-300x300.jpg';
  523.                                             } ?>
  524.                                             <img src="<?php echo esc_url( $image_url ); ?>"></a>
  525.                                         </div><!--.image-wrapper-->
  526.                                         <div class="drinks-content">
  527.                                             <h5 class="color-black"><a href="<?php the_permalink( $post->ID ); ?>"><?php echo esc_html( $post->post_title ); ?></a></h5>
  528.                                             <?php $tag = ( $content_type == 'woo-category' ) ? 'product_tag' : 'post_tag';
  529.                                                 $tags = get_the_terms( $post->ID, $tag );
  530.                                                 if ( ! empty( $tags ) ) :
  531.                                                     foreach ( $tags as $tag ) : ?>
  532.                                                         <a href="<?php echo esc_url( get_term_link( $tag->term_id ) ); ?>" class="more-link small-btn order-item"><?php echo esc_html( $tag->name ); ?></a>
  533.                                                     <?php endforeach;
  534.                                                 endif;
  535.                                             ?>                                     
  536.                                             <span><?php esc_html_e( 'From','yummy-pro' );
  537.                                             if ( $content_type == 'woo-category' ) : ?>
  538.                                                 <span class="price">
  539.                                                     <?php  
  540.                                                     $product = new WC_Product( $post->ID );
  541.                                                     echo $product->get_price_html();
  542.                                                     ?>
  543.                                                 </span>
  544.                                             <?php endif; ?>
  545.                                             </span>
  546.                                         </div>
  547.                                     </div><!--.post-content-->
  548.                                 <?php } ?>
  549.                             </div><!-- #coffee -->                 
  550.                         <?php $index++; endforeach; ?>
  551.                         </div><!--.drink-list-->
  552.                     </div><!--.column-wrapper-->
  553.                 </div><!--.col-2-->
  554.             </div><!--.wrapper-->  
  555.  
  556.             <div class="page-decoration">
  557.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-09.jpg" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  558.                 <img src="<?php echo get_template_directory_uri(); ?>/assets/uploads/menu-dish-10.jpg" alt="<?php esc_attr_e( 'Decoration', 'yummy-pro' ); ?>">
  559.             </div><!-- .page-decoration -->
  560.         </section><!-- #todays-menu -->
  561.     <?php }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement