• Resolved George

    (@quantum_leap)


    Is it possible to include a custom loading animated icon and center it on the container?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Milan Hirapra

    (@milanhirapra1)

    Hello George,

    This has an option to change the custom loader.
    Here is filter to change icon pages wise :

    apply_filters( "sap/loader_text", String $loader_text, Intiger $page_id )

    Thread Starter George

    (@quantum_leap)

    Hi, can you please give me a bit more guidance? I am still not clear on how to load a custom animated icon. Let’s say I have a gif named “loader.gif” inside a folder in my child theme named “images”. How should I use the filter to display that gif instead of the default text “Loading…”?

    Thank you.

    Thread Starter George

    (@quantum_leap)

    I managed to use a filter to change the loading text:

    function loading_text() {
    	
        return 'Loading posts...';
    }
    
    add_filter( "sap/loader_text", 'loading_text' );

    But how can I change the text to an image?

    Can you please help?

    Thread Starter George

    (@quantum_leap)

    Got it sorted, here is the code if anyone is interested:

    function loading_text() {
        $loading_img_url = get_stylesheet_directory_uri() . "/img/loader.gif";
        $loading_img = '<img src="' . $loading_img_url . '" alt="loader">' ;
    
        return $loading_img;
    }
    
    add_filter( "sap/loader_text", 'loading_text' );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom loading icon’ is closed to new replies.