Advertisement
artemsemkin

Cassio: nav-portfolio.php backup

Mar 4th, 2022
1,756
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.05 KB | None | 0 0
  1. <?php
  2.  
  3. $arts_next_post  = get_previous_post();
  4. $arts_prev_post  = get_next_post();
  5. $arts_current_id = get_the_ID();
  6. $arts_next_link;
  7. $arts_next_title;
  8. $arts_prev_link;
  9. $arts_prev_title;
  10. $arts_enable_portfolio_loop         = get_theme_mod( 'enable_portfolio_loop', true );
  11. $arts_class_link                    = 'col';
  12. $arts_page_portfolio_nav_theme      = arts_get_document_option( 'page_portfolio_nav_theme' );
  13. $arts_enable_portfolio_archive_link = get_theme_mod( 'enable_portfolio_archive_link', true );
  14. $arts_portfolio_archive_link        = get_theme_mod( 'portfolio_archive_link', '' );
  15.  
  16. $arts_posts = get_posts( array(
  17.     'post_type'      => 'arts_portfolio_item',
  18.     'posts_per_page' => -1,
  19. ) );
  20.  
  21. $arts_first_post = current( $arts_posts );
  22. $arts_last_post  = end( $arts_posts );
  23.  
  24. if ( $arts_next_post ) {
  25.     $arts_next_link  = get_permalink( $arts_next_post );
  26.     $arts_next_title = $arts_next_post->post_title;
  27.     $arts_next_cat = (get_the_terms($arts_next_post->ID, 'arts_portfolio_category')[0]->name ?? '');
  28. }
  29.  
  30. if ( ! $arts_next_post && $arts_enable_portfolio_loop ) {
  31.     $arts_next_post  = $arts_first_post;
  32.     $arts_next_link  = get_permalink( $arts_next_post );
  33.     $arts_next_title = $arts_next_post->post_title;
  34.     $arts_next_cat = (get_the_terms($arts_next_post->ID, 'arts_portfolio_category')[0]->name ?? '');
  35. }
  36.  
  37. if ( $arts_prev_post ) {
  38.     $arts_prev_link  = get_permalink( $arts_prev_post );
  39.     $arts_prev_title = $arts_prev_post->post_title;
  40.     $arts_prev_cat = (get_the_terms($arts_prev_post->ID, 'arts_portfolio_category')[0]->name ?? '');
  41. }
  42.  
  43. if ( ! $arts_prev_post && $arts_enable_portfolio_loop ) {
  44.     $arts_prev_post  = $arts_last_post;
  45.     $arts_prev_link  = get_permalink( $arts_prev_post );
  46.     $arts_prev_title = $arts_prev_post->post_title;
  47.     $arts_prev_cat = (get_the_terms($arts_prev_post->ID, 'arts_portfolio_category')[0]->name ?? '');
  48. }
  49.  
  50. if ( $arts_next_post && $arts_prev_post && $arts_enable_portfolio_archive_link && ! empty( $arts_portfolio_archive_link ) ) {
  51.     $arts_class_link = 'col-md-5';
  52. }
  53.  
  54. if ( $arts_next_post && $arts_prev_post && ( ! $arts_enable_portfolio_archive_link || empty( $arts_portfolio_archive_link ) ) ) {
  55.     $arts_class_link = 'col-md-6';
  56. }
  57.  
  58. if ( ! $arts_page_portfolio_nav_theme ) {
  59.     $arts_page_portfolio_nav_theme = 'bg-white';
  60. }
  61.  
  62. ?>
  63.  
  64. <?php if ( $arts_next_post || $arts_prev_post ) : ?>
  65.     <div class="section-nav-projects bg-accent-primary-4">
  66.         <div class="row no-gutters">
  67.             <a href="<?php echo esc_url( $arts_prev_link ); ?>" class="section-nav-projects__inner section-nav-projects__inner_prev <?php echo esc_attr( $arts_class_link ); ?>" data-pjax-link="flyingHeading">
  68.                 <div class="section-nav-projects__wrapper-heading section-nav-projects__wrapper-heading_prev">
  69.                     <div class="section-nav-projects__subheading section-nav-projects__heading_prev split-text js-split-text" data-split-text-type="lines, words, chars" data-split-text-set="chars"><?php echo esc_html( $arts_prev_cat ); ?></div>
  70.                     <div class="section-nav-projects__heading section-nav-projects__heading_prev split-text js-split-text js-text-to-fly" data-split-text-type="lines, words, chars" data-split-text-set="chars"><?php echo esc_html( $arts_prev_title ); ?></div>
  71.                 </div>
  72.                 <div class="section-nav-projects__arrow section-nav-projects__arrow_prev material-icons">keyboard_arrow_left</div>
  73.             </a>
  74.             <?php if ( $arts_enable_portfolio_archive_link && ! empty( $arts_portfolio_archive_link ) ) : ?>
  75.                 <a href="<?php echo get_permalink( $arts_portfolio_archive_link ); ?>" class="col-md-2 section-nav-projects__inner section-nav-projects__inner_all">
  76.                     <div class="button-circles">
  77.                         <div class="button-circles__circle">
  78.                             <?php get_template_part( 'template-parts/svg/circle' ); ?>
  79.                         </div>
  80.                         <div class="button-circles__circle">
  81.                             <?php get_template_part( 'template-parts/svg/circle' ); ?>
  82.                         </div>
  83.                         <div class="button-circles__circle">
  84.                             <?php get_template_part( 'template-parts/svg/circle' ); ?>
  85.                         </div>
  86.                         <div class="button-circles__circle">
  87.                             <?php get_template_part( 'template-parts/svg/circle' ); ?>
  88.                         </div>
  89.                     </div>
  90.                 </a>
  91.             <?php endif; ?>
  92.             <a href="<?php echo esc_url( $arts_next_link ); ?>" class="section-nav-projects__inner section-nav-projects__inner_next <?php echo esc_attr( $arts_class_link ); ?>" data-pjax-link="flyingHeading">
  93.                 <div class="section-nav-projects__wrapper-heading section-nav-projects__wrapper-heading_next">
  94.                     <div class="section-nav-projects__subheading section-nav-projects__heading_next split-text js-split-text" data-split-text-type="lines, words, chars" data-split-text-set="chars"><?php echo esc_html( $arts_next_cat ); ?></div>
  95.                     <div class="section-nav-projects__heading section-nav-projects__heading_next split-text js-split-text js-text-to-fly" data-split-text-type="lines, words, chars" data-split-text-set="chars"><?php echo esc_html( $arts_next_title ); ?></div>
  96.                 </div>
  97.                 <div class="section-nav-projects__arrow section-nav-projects__arrow_next material-icons">keyboard_arrow_right</div>
  98.             </a>
  99.         </div>
  100.     </div>
  101. <?php endif; ?>
  102.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement