PHP code example of gmazzap / ajax-template-part

1. Go to this page and download the library: Download gmazzap/ajax-template-part library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gmazzap / ajax-template-part example snippets


 add_filter( 'ajax_template_cache_driver', function() {
   return '\Stash\Driver\Memcache';
 });

 add_filter( "ajax_template_memcache_driver_conf", function() {
   return [ 'servers' => ['127.0.0.1', '11211'] ];
 });
 
 php
ajax_template_part( 'content' );
 php
ajax_template_part( 'content', 'page' );
 php
if ( ! function_exists( 'ajax_template_part' ) ) {
  function ajax_template_part( $name = '', $slug = '' ) {
    return get_template_part( $name, $slug );
  }
}
if ( ! function_exists( 'ajax_template_part_content' ) ) {
  function ajax_template_part_content( $content = '', $name = '', $slug = '' ) {
    return get_template_part( $name, $slug );
  }
}