I'm creating my pages links in wordpress, using wp_list_pages(). each link contains an <i> tag which displays retina icons. I want to set a different class for each link in order to display a different retina icon. my code so far is this:

<?php wp_list_pages('link_before=<i class="A RETINA ICON CLASS NAME"></i>&link_after=<br >'); ?> 

How can I do that using pages meta data?or other ways?


You can do it easily with jQuery by using .eq() to add a specific class to each i element.


Add a class to your i element from PHP.

<?php wp_list_pages('link_before=<i class="retina_icon"></i>&link_after=<br >'); ?> 

Then add another class to it with jQuery.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy