feat: add content feed with AJAX filtering and load more on front page
This commit is contained in:
@@ -16,13 +16,33 @@ add_action( 'wp_enqueue_scripts', 'bitwms_enqueue_scripts', 20 );
|
||||
|
||||
function bitwms_enqueue_scripts() {
|
||||
$theme_version = wp_get_theme()->get( 'Version' );
|
||||
$theme_uri = get_stylesheet_directory_uri();
|
||||
|
||||
// Sidebar navigation — loaded in footer (5th arg: true).
|
||||
wp_enqueue_script(
|
||||
'bitwms-sidebar-nav',
|
||||
get_stylesheet_directory_uri() . '/js/sidebar-nav.js',
|
||||
$theme_uri . '/js/sidebar-nav.js',
|
||||
array(), // no dependencies
|
||||
$theme_version,
|
||||
true // load in footer
|
||||
);
|
||||
|
||||
// Content feed AJAX filter — front page only.
|
||||
if ( is_front_page() ) {
|
||||
wp_enqueue_script(
|
||||
'bitwms-ajax-filter',
|
||||
$theme_uri . '/js/ajax-filter.js',
|
||||
array(),
|
||||
$theme_version,
|
||||
true
|
||||
);
|
||||
wp_localize_script(
|
||||
'bitwms-ajax-filter',
|
||||
'bitwmsAjax',
|
||||
array(
|
||||
'url' => admin_url( 'admin-ajax.php' ),
|
||||
'nonce' => wp_create_nonce( 'bitwms_filter_nonce' ),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user