• Hello everyone

    I have created an icon for each slug set in the Category menu, and now I have to get WP to automatically change the color of the icons for newly created slugs. As a possible workaround, I created style.php and added the following line to the template PHP file:

    <link rel=”stylesheet” type=”text/css” href=”./css/style.php”>

    And style.php contains the following:

    <? echo “.”.$slug.”{background: #rr0000;}” ?>

    Then, when I check the same css in the browser, I see that nothing have been returned for $slug as below:

    .{background: #rr0000;}

    This is despite the fact that $slug is defined as follows in the template php file:

    $categories = get_the_category();
    foreach($categories as $category) {
    $slug = $category->slug;}

    I’m completely stuck as to why $slug cannot call a slug ID. Could someone please help me find what could be used to display slug IDs in css?

    Thank you in advance

  • The topic ‘Automatically change the colour of slug-related icons?’ is closed to new replies.