Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #780

    How can I link the images in the accordion slider to a category instead of a page?


    The easiest way to do this is to use a custom field on the slider page (in WP admin).

    On the edit post page, add a custom field called “link” and add the category link here.

    Next, open up index.php and find this code (around line 41):

    <a href="<?php the_permalink(); ?>">

    and replace it with this:

    <?php if ( get_post_meta($post->ID, 'link', true) ) { ?>
    <a href="<?php echo get_post_meta($post->ID, 'link', true) ?>">
    <?php } else { ?>
    <a href="<?php the_permalink(); ?>">
    <?php } ?>

    If the custom field exists, this link is displayed otherwise it defaults to the slide link.


    Re: Newscast

    How do I link the 5 accordion slider images to pages instead of posts that remain static (don’t change)?

    Also, I’m having a problem with the navigation bar below the header. The custom menus I create are duplicated.


    1: Home > About > Dropdown > Fullwidth Page > Contact > About

    2: Tech News > Adobe > Community > Browser > Illustrator…


    1: Home > Cosmetic Dentistry > General Dentistry…

    2: Home > Cosmetic Dentistry > General Dentistry…

    Any and all help is much appreciated! Thanks!




    The code I posted above should work – have you tried this?

    You’d need to add the link to each slide or it will default to the permalink.



Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Accordion Slider – Link to Category’ is closed to new replies.