• Hello,

    i have a wordpress theme, this theme uses a background image in the blog, i have different types of blog ( football, basketball, …), the background image is defined in the style css file of the theme style.css

    .gdlr-header-wrapper{ z-index: 99; position: relative;
    background-image: url(‘images/page-title-background.jpg’); background-repeat: repeat; background-position: 40% 60%; }

    and it called by this function in header.php: wp_head();
    i would like to create a filter on wp_head that i can change dynamically the background image depending of the category of the blog how can i do this?

    i have tested this but it doesn’t work for me:

    add_action(‘wp_head’,’hook_css’);
    function hook_css()
    {

    $output=”<style> .gdlr-header-wrapper{ z-index: 99; position: relative;
    background-image: url(‘screenshoot.png’); background-repeat: repeat; background-position: 40% 60%; } </style>”;

    echo $output;

    }

    need your help
    thanks in advance

  • The topic ‘add custom style’ is closed to new replies.