<?php $field_object = get_field_object('field_name');
if ( $field_object && !empty($field_object['value']) ) { ?>
<div class="xxx">
<?php echo esc_html($field_object['label']); ?>
<b><?php echo esc_html($field_object['value']); ?></b>
</div>
<?php } ?>
Get all ACF subs from a group field
<?php
if ( have_rows('prd_group') ) :
while ( have_rows('prd_group') ) : the_row();
$sub_fields = get_row(true); // returns all sub fields
foreach( $sub_fields as $key => $value ) { ?>
<?php echo esc_html($key) ?>
<?php echo esc_html($value) ?>
<?php
}
endwhile;
endif;
?>
function wpse_6533_map_unrestricted_upload_filter($caps, $cap) {
if ($cap == 'unfiltered_upload') {
$caps = array();
$caps[] = $cap;
}
return $caps;
}
add_filter('map_meta_cap', 'wpse_6533_map_unrestricted_upload_filter', 0, 2);
<div class="atabs">
<span class="atab">Content</span>
<span class="atab">Design</span>
<span class="atab">Layout</span>
</div>
<div class="atab_con">
<div class="atab_co">Content</div>
<div class="atab_co">Design</div>
<div class="atab_co">Layout</div>
</div>
<script>
jQuery(".atabs .atab").click(function() {
jQuery(".atabs .atab").removeClass("active").eq(jQuery(this).index()).addClass("active");
jQuery(".atab_co").hide().eq(jQuery(this).index()).fadeIn()
}).eq(0).addClass("active");
</script>
<style>
.atab {
background: transparent;
color: #000;
border: 1px solid #ddd;
padding: 0.4em 2em;
border-radius: 100px;
cursor: pointer;
}
.atabs .active {
background: #000;
color: #fff;
border: 1px solid #000;
}
.atab_co {
display: none;
width: 100%;
padding: 40px 0 0 0;
}
.atab_co:first-child {
display: block;
}
</style>
<?php
if( have_rows('repeater_field_name') ): ?>
<?php while( have_rows('repeater_field_name') ): the_row();
// Get the value of the checkbox field for the current row
$checkbox_value = get_sub_field('checkbox_field_name');
// Check if the checkbox is checked (true)
if( $checkbox_value ) {
// Display content when the checkbox is checked
?>
<div class="repeater-row">
<p>Checkbox is checked for this row.</p>
<?php
// Display other sub-fields within the repeater row if needed
// Example:
// the_sub_field('text_field_name');
?>
</div>
<?php
} else {
// Optional: Display something else when the checkbox is not checked
// echo '<p>Checkbox is not checked for this row.</p>';
}
?>
<?php endwhile; ?>
<?php endif; ?>
<div class="atabs">
<span class="atab">Content</span>
<span class="atab">Design</span>
<span class="atab">Layout</span>
</div>
<div class="atab_con">
<div class="atab_co">Content</div>
<div class="atab_co">Design</div>
<div class="atab_co">Layout</div>
</div>
<script>
jQuery(".atabs .atab").click(function() {
jQuery(".atabs .atab").removeClass("active").eq(jQuery(this).index()).addClass("active");
jQuery(".atab_co").hide().eq(jQuery(this).index()).fadeIn()
}).eq(0).addClass("active");
</script>
<style>
.atab {
background: transparent;
color: #000;
border: 1px solid #ddd;
padding: 0.4em 2em;
border-radius: 100px;
cursor: pointer;
}
.atabs .active {
background: #000;
color: #fff;
border: 1px solid #000;
}
.atab_co {
display: none;
width: 100%;
padding: 40px 0 0 0;
}
.atab_co:first-child {
display: block;
}
</style>
Polylang for oxygen builder
if( function_exists('oxygen_vsb_register_condition') && function_exists('pll_languages_list') ) {
$lang_list = pll_languages_list();
oxygen_vsb_register_condition(
//Condition Name
'Locale',
//Values
array(
'options' => $lang_list,
'custom' => false
),
//Operators
array('==', '!='),
//Callback Function
'polylang_callback',
//Condition Category
'Polylang'
);
function polylang_callback($value, $operator) {
$my_lang = pll_current_language();
global $OxygenConditions;
return $OxygenConditions->eval_string($my_lang, $value, $operator);
}
}
<?php
$terms = get_terms( array(
'taxonomy' => 'destination', // set your taxonomy here
'hide_empty' => false, // default: true
) );
if ( empty( $terms ) || is_wp_error( $terms ) ) {
return;
}
echo '<ul>';
foreach( $terms as $term ) {
printf(
'<li><a href="%s">%s</a> <span class="term-count">(%s)</span></li>',
esc_url( get_term_link( $term ) ),
esc_attr( $term->name ),
$term->count
);
}
echo '</ul>';
?>
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => '',
'show_count' => 1,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 2,
'title_li' => __( '' ),
'show_option_none' => __('No categories'),
'number' => null,
'echo' => 1,
'depth' => 2,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'destination',
'walker' => null
);
wp_list_categories( $args );
?>
<?php
$wcatTerms = get_terms('destination', array('hide_empty' => 0, 'parent' =>0));
foreach($wcatTerms as $wcatTerm) :
?>
<div class="dest item">
<?php echo $wcatTerm->name; ?>
<div class="cov">
<?php
$wcatTerms1 = get_terms('destination', array('hide_empty' => 0, 'parent' =>$wcatTerm->term_id));
foreach($wcatTerms1 as $wcatTerm1) :
?>
<a href="<?php echo get_term_link( $wcatTerm1->slug, $wcatTerm1->taxonomy ); ?>"><?php echo $wcatTerm1->name; ?></a>
<?php endforeach ; ?>
</div>
</div>
<?php endforeach ; ?>
Horizontal scroll with arrows
const buttonRight = document.getElementById('slideRight');
const buttonLeft = document.getElementById('slideLeft');
buttonRight.onclick = function () {
document.getElementById('container').scrollLeft += 20;
};
buttonLeft.onclick = function () {
document.getElementById('container').scrollLeft -= 20;
};
#container {
width: 145px;
height: 100px;
border: 1px solid #ccc;
overflow-x: scroll;
}
#content {
width: 250px;
background-color: #ccc;
}
<div id="container">
<div id="content">Click the buttons to slide horizontally!</div>
</div>
<button id="slideLeft" type="button">Slide left</button>
<button id="slideRight" type="button">Slide right</button>
<?php if ( have_rows( 'faqs', 'options' ) ) : ?>
<?php $i = 1; while ( have_rows( 'faqs', 'options' ) ) :
the_row(); ?>
<?php if ( $faq_title = get_sub_field( 'faq_title', 'options' ) ) : ?>
<a class='btn btn-l mb' href='#<?php echo $i; ?>'><?php echo esc_html( $faq_title ); ?></a>
<?php endif; ?>
<?php $i++; endwhile; ?>
<?php endif; ?>
<?php if ( have_rows( 'faqs', 'options' ) ) : ?>
<?php $i = 1; while ( have_rows( 'faqs', 'options' ) ) :
the_row(); ?>
<div id='<?php echo $i; ?>'>
<?php if ( $faq_title = get_sub_field( 'faq_title', 'options' ) ) : ?>
<h2 class='h2 mb-x'><?php echo esc_html( $faq_title ); ?></h2>
<?php endif; ?>
<div class='mb-xl'>
<?php if ( have_rows( 'faq_faqs', 'options' ) ) : ?>
<?php while ( have_rows( 'faq_faqs', 'options' ) ) :
the_row(); ?>
<div class='h-faq-item'>
<a class='h-faq'>
<?php if ( $faq_question = get_sub_field( 'faq_question', 'options' ) ) : ?>
<h4 class='h4 h-faq-q'><?php echo esc_html( $faq_question ); ?></h4>
<?php endif; ?>
<i class="faq-i fal fa-angle-down"></i>
</a>
<div class='h-faq-co'>
<?php if ( $faq_answer = get_sub_field( 'faq_answer', 'options' ) ) : ?>
<?php echo $faq_answer; ?>
<?php endif; ?>
</div>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>
<?php $i++; endwhile; ?>
<?php endif; ?>
<script>
jQuery('.h-faq').click(function(e) {
e.preventDefault();
var $this = jQuery(this);
$this.next().slideToggle(400);
$this.find('.faq-i').toggleClass('faq-i-open');
jQuery(this).toggleClass('h-faq-open');
});
</script>
<style>
.faq-i {
font-size: 27px;
transition: 0.2s;
}
.faq-i-open {
-webkit-transform: rotate(180deg);
}
.h-faq-open {
color: #197df5 !important;
}
.h-faq-co {
display: none;
}
</style>