Problem with adding custom CSS class to image in ACF Photo Gallery plugin [closed]

Try this code at the place where you want your gallery: <?php $images = acf_photo_gallery(‘gallery_images’, $post->ID); /// gallery_images to slug pola galeria w ACF if( count($images) ): foreach($images as $image): $full_image_url= $image[‘full_image_url’]; $class = get_field(‘gallery_images_class’, $id); echo ‘<img src=”‘.$image[‘full_image_url’].'” class=”‘.$class.'” >’; endforeach; endif; ?> Do try to check if ‘$id’ gives you the image/post id … Read more

How to create shortcode with html and php content?

To create a shortcode from your functions, you need to use the following code: function my_shortcode_function(){ if (get_option(‘pixieclash-standings-background’) && get_option(‘pixieclash-standings-background’) != null) { $background = esc_url(get_option(‘pixieclash-standings-background’)) } else { $background = get_stylesheet_directory_uri() . ‘/images/standings-bg.jpg’; } $headTxt = get_option(‘pixieclash-standings-section-heading-top’); $bottomText = get_option(‘pixieclash-standings-section-heading-bottom’); if(!empty($headTxt)){ $text_header=”<h4>”. esc_attr($headTxt);.'</h4>’; } else { $text_header=””; } if(!empty($bottomText)) { $text_footer=”<h3>”.esc_attr($bottomText); .'</h3>’; } else … Read more

Combine two active_callbacks into one on theme customizer

Maybe I’m misreading your question, but combining these two conditions in one anonymous function doesn’t look that difficult: ‘active_callback’ => function() use ( $wp_customize ) { $condition1 == $wp_customize->get_setting( ‘twsa_show_schedule’ )->value(); $condition2 == $wp_customize->get_setting( ‘twsa_show_active’ )->value(); return ($condition1 && $condition2); } For really smart thinking on active callbacks, read Otto’s take on them.

Get post by tag

Look at this section: Tag parameters in WP Codex, where is explained search by tags. Your code like right. Try change numberposts to int: <?php $args = array( ‘numberposts’ => 3, ‘post_status’ => ‘publish’, ‘tag’ => ‘travel’ );

Default Nav Highlight

Assuming you are loading a single piece of content like one Post (unlike the homepage where you’re combining multiple Pages with JS), something like this should do it: <script type=”text/javascript”> $(document).ready(function(){ // get each menu item var hasHighlight = 0; // loop through to see if any have “current_page_item” class $(“#nav ul li”).each(function(obj) { if($(this).hasClass(“current_page_item”)) … Read more

Delay a function, any function!

You could solve this via WP Cron using wp_schedule_single_event(). However, for this to properly work, you’d need to disable the standard cron (which is run by a user visiting the site) and instead use a proper cronjob/crontab. EasyEngine has a good tutorial on disabling wp-cron and using cronjob instead. An alternative would be solve this … Read more