Wordpress Javascript Index Loop

O

ovation

I want to use javascript to display the categories that the post is
filed under when a icon/image is clicked. The list of categories
should expand at the bottom of the post under the icon(s).

This works great on the single post page, but the index (main) page
lists 10 posts, and it will only work on the first post. No matter
what post icon is clicked the first post expands. I think I
understand the logic behind this, but is there any way around it?

Here is the code:

`<a href="javascript:Effect.Combo('file', {duration: 0.5});"
title="Filed Under"><img src="<?php echo bloginfo('template_url'); ?>/
images/file.gif" /></a>

<div id="file" style="display: none;">
<?php echo ''; _e(get_the_category_list(', ')) ?></div>`

Thanks
 
O

ovation

O

ovation

I want to use javascript to display the categories that the post is
filed under when a icon/image is clicked. The list of categories
should expand at the bottom of the post under the icon(s).

This works great on the single post page, but the index (main) page
lists 10 posts, and it will only work on the first post. No matter
what post icon is clicked the first post expands. I think I
understand the logic behind this, but is there any way around it?

Here is the code:

`<a href="javascript:Effect.Combo('file', {duration: 0.5});"
title="Filed Under"><img src="<?php echo bloginfo('template_url'); ?>/
images/file.gif" /></a>

<div id="file" style="display: none;">
<?php echo ''; _e(get_the_category_list(', ')) ?></div>`

Thanks

Thanks to "Kjell Bublitz" I have a solution. Here it is if anyone
needs it:

<a href="javascript:Effect.Combo('file<?php the_ID(); ?>',
{duration: 0.5});" title="Filed Under"><img src="<?php echo
bloginfo('template_url'); ?>/images/file.gif" /></a>

<div id="file<?php the_ID(); ?>" style="display: none;">
<?php echo ''; _e(get_the_category_list(', ')) ?></div>

Thanks to everyone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top