Support » Plugin: PWA for WP & AMP » Change h3 tag in custom add to home banner

  • Resolved slr1979

    (@slr1979)


    Is there any way to alter the HTML for the Custom Add To Home Banner with filtering? The h3 tag in the banner is causing issues with my SEO on pages with no H2 tags so I have had to disable the banner for now.

    I can see the function in class-service-worker.php but there does not appear to be a way to modify the HTML.

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Magazine3

    (@magazine3)

    You can do via remove and add action directly.
    add_action(‘wp_footer’, array($this, ‘pwaforwp_custom_add_to_home_screen’));

    Thread Starter slr1979

    (@slr1979)

    Many thanks for your response.

    Could you provide an example of how to do this as I cannot use $this in my theme functions.php

    I tried this code below but it does not appear to remove the banner so I can override the function and replace the html.

    function remove_my_class_action() { 
    	remove_action( 'wp_footer', array( 'PWAFORWP_Service_Worker', 'pwaforwp_custom_add_to_home_screen' ), 11);
    }
    add_action( 'wp_head', 'remove_my_class_action' );
    Thread Starter slr1979

    (@slr1979)

    Hello,

    I have not received a reply to my last post. Could anyone advise me?

    Thanks

    Plugin Author Magazine3

    (@magazine3)

    We will give one example to change h3 tag in custom add to home banner. Please follow this code: https://pastebin.com/gEZ79n5B

    Thread Starter slr1979

    (@slr1979)

    Many thank for this. It is very much appreciated

    There is one error in you example which you may wish to correct in case anyone else wishes to use this code…

    remove_action('wp_footer', 'overwrite_custom_add_to_home_screen');

    should be

    add_action('wp_footer', 'overwrite_custom_add_to_home_screen');

    I have been able to successfully modify the header of the popup to suit my requirements.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change h3 tag in custom add to home banner’ is closed to new replies.