Adding jQuery UI elements to WordPress page

Using jquery-ui widgets requires a couple of steps. You will need to add the appropriate markup for your widget. I’ll use the slider as an example. I just created a new page and added the markup below to it in the text editor in the WordPress admin: <div id=”sample-theme-slider”></div> You’re going to have to have … Read more

Ajax form submit not working, returns 0

The action: ‘ajax_contact’ part in: var data = $form.serialize(); console.log(data); $.ajax({ url: ajax_contact.ajaxurl, dataType: ‘json’, action: ‘ajax_contact’, data: ajax_contact.data, is most likely the cause here, that your ajax request is failing. Move the action part into the data set instead. Since you’re serializing the form data, you could try to add: <input type=”hidden” name=”action” value=”ajax_contact” … Read more

ACF – add a group inside a repeater [closed]

You code looks very confusing. Why are you using the ‘foreach’? If you follow the ACF documentation, you just need to use: <?php if( have_rows(‘questions’) ): while( have_rows(‘questions’) ): the_row(); // vars $repeater-item = get_sub_field(‘repeater-item’); ?> <div class=”content”> <?php the_sub_field(‘caption’); ?> </div> For the group. Source: https://www.advancedcustomfields.com/resources/group/ And you only have to use: if( have_rows(‘item’) … Read more

FacetWP – conditionally display facet labels

Your code seems identical to FacetWP’s. The only variable I can think of is code placement. You might not be placing the code where it belongs (functions.php or a plugin). A quick fix would be adding their code to your theme’s functions.php: function fwp_add_facet_labels() { ?> <script> (function($) { $(document).on(‘facetwp-loaded’, function() { $(‘.facetwp-facet’).each(function() { var … Read more

Add Ajax Hooks and Call from Custom Template PHP

may be here is the error add_action( ‘wp_ajax_my_ajax_action’, ‘my_ajax_action_callback’ ); add_action( ‘wp_ajax_nopriv_my_ajax_action’, ‘my_ajax_action_callback’ ); change to add_action( ‘wp_ajax_my_ajax_action_callback’, ‘my_ajax_action_callback’ ); add_action(‘wp_ajax_nopriv_my_ajax_action_callback’,’my_ajax_action_callback’ ); and in ajax change: action : ‘my_ajax_action_callback go to functions.php and add: require(dirname(__FILE__) . ‘/custom_template.php’); make sure your ajax url is correct!!