• I don’t like to post code that might be too particular, but I have a very specific function that is not going relative. I’m using the storefront theme.

    
    // Update site logo
    function storefront_custom_logo() {
        remove_action( 'storefront_header', 'storefront_site_branding', 20 );
        add_action( 'storefront_header', 'storefront_display_custom_logo', 20 );
    }
    add_action( 'init', 'storefront_custom_logo' );
    
    // Auxiliar function
    function storefront_display_custom_logo() {
        ?>
        <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">
            <img src="<?= get_stylesheet_directory_uri(); ?>/img/img.png" alt="" />
        </a>
        <?php
    }
    

    get_stylesheet_directory_uri works in other places, so I don’t know what is causing the issue here but none of those 2 paths are working. Perhaps is it the init function?

    • This topic was modified 7 years, 2 months ago by cpucpu.
Viewing 1 replies (of 1 total)
  • Plugin Author Sami Ahmed Siddiqui

    (@sasiddiqui)

    @cpucpu Sorry about the late response.

    Issue is that you are directly printing get_stylesheet_directory_uri in HTML. If it is used in enqueue function or some other function so, i can make them relative. but if anyone is directly printing the URL in HTML so, the plugin doesn’t make it relative.

    This feature would be added in the later version which can read the entire HTML and make the URLs relative from there as well.

    Thanks,
    Sami

Viewing 1 replies (of 1 total)
  • The topic ‘get_stylesheet_directory_uri()’ is closed to new replies.