11

How can I disable ajax content loading for the Post Grid VC Shortcode?

I don't want the loading dots to show.

Thanks

Cptn
  • 123
  • 1
  • 7
  • 1
    Hi, there is no way to do it. But you can always create a shortcode to load your posts and map it with VC Shortcode Mapper. – Rogers Sampaio Sep 20 '17 at 10:24
  • you could even add your shortcode as a component to visual composer via code, but the idea is to keep the current post grid component functionality, including VC's grid template editor – NiloVelez Sep 21 '17 at 15:13
  • If you use display style "pagination" then in Pagination > Pagination style set to none it will remove dots and ajax data – Mukesh Panchal Sep 25 '17 at 06:16
  • @MukeshPanchal Thank you very much, I've been struggling with this problem for months. The only problem with your solution is that it doesn't work with custom queries, buy I can live with that. Please add your comment as an answer and will gladly award the bounty to you. – NiloVelez Sep 27 '17 at 22:15
  • @NiloVelez i added my answer – Mukesh Panchal Sep 28 '17 at 04:56

4 Answers4

1

In Post Grid Visual Composer Shortcode If you use display style as "pagination" then you have to set Pagination style from here: Pagination > Pagination style ( Select "None" ). it will remove dots for pagination and there will be no ajax data for posts and no pagination. see attached image for more information.

enter image description here

Mukesh Panchal
  • 1,956
  • 2
  • 18
  • 31
  • I'm accepting this as a valid answer as it it is a solution for the original answer, the loading dots stop showing and the load is light and faster, but keep in mind that VC still uses admin-ajax.php to load the content. – NiloVelez Sep 28 '17 at 06:54
  • This is the actual code the shortcode renders: `
    `
    – NiloVelez Sep 28 '17 at 06:55
  • Yes, and that’s a problem for performance and SEO. It also reduces the impact of cache plugins – NiloVelez Sep 29 '17 at 08:18
0

Your question is "I don't want the loading dots to show", you simply do with add custom css

.vc_grid-loading {display: none;}

You can add custom css via click on top right gear icon of visual composer (see below image)

enter image description here

Nand Lal
  • 682
  • 1
  • 11
  • 25
0

Look in the plugin and find the name of the script that handles the AJAX and dequeue it.

/**
 * Dequeue a JS script.
 *
 * Hooked to the wp_print_scripts action, with a late priority (100),
 * so that it is after the script was enqueued.
 */
function wpdocs_dequeue_script() {
   wp_dequeue_script( 'script-name' );
}
add_action( 'wp_print_scripts', 'wpdocs_dequeue_script', 100 );
Dedering
  • 413
  • 2
  • 10
0

You could enclose the shortcode with a second shortcode that strips out the selectors that triggers the AJAX. See: enclosing shortcodes

[new-shortcode][original-shortcode][/new-shortcode]

function new_shortcode($atts = [], $content = null) {
  // do something to $content

  // run shortcode parser recursively
  $content = do_shortcode($content);

  // always return
  return $content;
}
add_shortcode('new-shortcode', 'new_shortcode');
Dedering
  • 413
  • 2
  • 10
  • Ajax is used to load the content, your solution would prevent the content from loading. The idea is loading the content via PHP instead of Ajax. You could enclose the shortcode with another shortcode that makes the Ajax call via curl using PHP and writes out the response – NiloVelez Sep 28 '17 at 07:41