• Resolved TRDD

    (@traceyrickard)


    I would like to add this to blog and archive templates in a custom theme. Is there a way to do this please? I have tried adding the CSS style snippets to the post classes but it doesn’t trigger the loading of the stylesheet or javascript.

Viewing 1 replies (of 1 total)
  • Plugin Author Arya Dhiratara

    (@aryadhiratara)

    Hi, @traceyrickard

    Never imagine that someone will use the animation in the archive pages untill now ??

    Really sorry, I still couldn’t find any reliable methods to conditionally enqueued the CSS & JS to the archive pages.

    For now, please use this until I came up with a reliable solution to automatically detect the ‘aos-‘ in archive pages.

    Put this in your function.php or code snippets plugin:

    
    add_action('wp_enqueue_scripts', function() {
    	if (is_archive() )  {
    		$aos_init = 'var aoswp_params = {
    			"offset":"200",
    			"duration":"1200",
    			"easing":"ease",
    			"delay":"0",
    			"once":true}';
    		wp_enqueue_script('aoswp-script');
    		wp_add_inline_script('aoswp-script', wp_kses_data($aos_init), 'before');
    		wp_enqueue_style('aoswp-style');
    	}
    });

    *change the conditional (is_archive) to anything that suits your needs.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Add to Blog and Archive Template’ is closed to new replies.