0

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?

1 Answer 1

0

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

Example:

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.

jQuery('.retina-icon:eq(0)').addClass("retina-icon-1");
jQuery('retina-icon:eq(1)').addClass("retina-icon-2");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.