Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) link color question

  • Fernando Mol

    October 1, 2010 at 3:29 pm

    Theoretically, you can go page after page and color your actual page link, but in the site you posted there are tons.

    I you know some server side programming language, you could compare the linked page to the actual page and if there’s a match, then add a class that colors the link. If you do this in an include you’ll need to do it only once.

    This would be an example of a PHP function that does that:

    <?php
    function menup($page) {
    if($_SERVER['PHP_SELF'] == $page){
    echo "class=\"menuWithColor\"";
    }
    }
    ?>

    Then, you add the funcion to each link in a list:

  • Just add a CSS class called menuWithColor and add your favorite color to your link.

    I hope this helps

    *Always share a link to your site and rate the posts. This is a free service for you and for us.

  • Zachary Zezima

    October 2, 2010 at 3:11 pm

    I’ve never used a PHP function or a list before? I tried searching for more info on php functions to figure out how to use your code, but I’m not really understanding how to make it do what I want. Any tips? Thanks a lot!!

  • Zachary Zezima

    October 2, 2010 at 3:19 pm

    P.S. I’m using a template, so the menu bar on the left is only editable in the template and not every page.

  • Fernando Mol

    October 8, 2010 at 3:36 am

    For each list item in your menu you should add the function like this:

    <li <?php menup("yourpage.php");?>><a href="yourpage.php">Link to your page</a></li>

    *Always share a link to your site and rate the posts. This is a free service for you and for us.

  • We use anonymous cookies to give you the best experience we can.
    Our Privacy policy | GDPR Policy