display Flexible Fields from options

According to ACF Docs on Get values from an options page. You should use ‘option’ not ‘options’ as the second parameter to the have_rows() function. <?php if( have_rows(‘repeater’, ‘option’) ): ?> <ul> <?php while( have_rows(‘repeater’, ‘option’) ): the_row(); ?> <li><?php the_sub_field(‘title’); ?></li> <?php endwhile; ?> </ul> <?php endif; ?>

Get a different meta value with ajax when different elements are clicked

I figured it out myself thanks to this Q&A. The problem was with closures in loops. Can’t really explain what happens but it works for me. jQuery(document).ready(function($){ $.ajax({ url: ajaxurl, data: { ‘action’:’ajax_action’, ‘post_id’ : 18 }, success:function(data) { var hero = JSON.parse(data); function createCallback( i ){ return function(){ $(‘.changing’).html(hero[i][‘description’]); } } $(document).ready(function(){ for(var i … Read more

Add Image With Changeable Link in Custom Field [closed]

I made this code with help from Google search. And it works fine. I added this code in single.php bottom of the post. Now, I simply add link in every post but image are same. Thanks. 🙂 <?php if( get_post_meta($post->ID, “imglink”, true) ): ?> <p><a href=”<?php echo get_post_meta($post->ID, “imglink”, true); ?>”><img src=”http://————-.png”></a></p> <?php endif; ?>

Create custom query for search?

Have you check your result-set, what result you are getting in $query obj. another thing, there is no need to use ‘relation’ => ‘OR’, in meta query array, have a try with this as well. And instead of ‘numberposts’ use ‘posts_per_page’ this will help. 🙂 or you can remove the meta_query and make your $arg … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)