Skip to content

Instantly share code, notes, and snippets.

@NickMkrtchyan
Last active August 17, 2022 12:00
Show Gist options
  • Save NickMkrtchyan/feb828fc99821893e91d9a46608ddc29 to your computer and use it in GitHub Desktop.
Save NickMkrtchyan/feb828fc99821893e91d9a46608ddc29 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wp_enqueue_scripts', 'liquid_child_theme_style', 99 );
function liquid_parent_theme_scripts() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
function liquid_child_theme_style(){
wp_enqueue_style( 'child-hub-style', get_stylesheet_directory_uri() . '/style.css' );
$currLang = pll_current_language();
if ( $currLang === 'hy' ) {
wp_enqueue_style( 'armenian-font', get_stylesheet_directory_uri() . '/assets/css/armenian-font.css', rand(11, 999) );
}
}
// Allow SVG file upload
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
// Language Setup
function yeraztravel_language_setup() {
$path = get_stylesheet_directory().'/languages';
load_child_theme_textdomain( 'yeraztravel', $path );
}
add_action( 'after_setup_theme', 'yeraztravel_language_setup' );
// Custom menus
function wpb_custom_new_menu() {
register_nav_menus(
array(
'inbound-tours' => __( 'Inbound Tours' ),
'outbound-tours' => __( 'Outbound Tours' )
)
);
}
add_action( 'init', 'wpb_custom_new_menu' );
add_shortcode( 'include_tabs', 'include_tabs_acf' );
function include_tabs_acf() {
if( have_rows('tab_test') ): ?>
<ul class="nav nav-tabs" id="myTab" role="tablist">
<?php $i=0; while ( have_rows('tab_test') ) : the_row(); ?>
<?php
$string = sanitize_title( get_sub_field('tab_title') );
?>
<li role="presentation" <?php if ($i==0) { ?>class="active"<?php } ?> >
<a href="#<?php echo $string ?>" aria-controls="<?php echo $string ?>" role="tab" data-toggle="tab"><?php the_sub_field('tab_title'); ?></a>
</li>
<?php $i++; endwhile; ?>
</ul>
<div class="tab-content">
<?php $i=0; while ( have_rows('tab_test') ) : the_row(); ?>
<?php
$string = sanitize_title( get_sub_field('tab_title') );
?>
<div role="tabpanel" class="tab-pane text-center fade <?php if ($i==0) { ?>in active<?php } ?>" id="<?php echo $string; ?>">
<div class="col-lg-6"><?php the_sub_field('tab_content'); ?></div>
<div class="col-lg-6"><?php //the_sub_field('gallery'); ?></div>
<?php
//Gallery Output
// Load value (array of ids).
$images = get_field('gallery');
if( $images ): ?>
<ul>
<?php foreach( $images as $image ): ?>
<li>
<a href="<?php echo $image['url']; ?>">
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</a>
<p><?php echo $image['caption']; ?></p>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php $i++; endwhile; ?>
</div>
<?php endif;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment