Forums

[resolved] XHTML compliance - duplicate id error (3 posts)

  1. franticorang
    Member
    Posted 6 years ago #

    Hello

    I am trying to customise a WP theme and use Mark A Shields breadcrumbs navigation (http://markashields.com/) at the same time. I am also trying to make it xhtml compliant.

    The problem is that the breadcrumbs script creates an id that is then used for the post title. When I validate I get:

    Line 68, column 27: ID "post-24" already defined
    <h3 class="storytitle" id="post-24"><a href="http:...

    Line 58, column 283: ID "post-24" first defined here
    ...tag">Case Studies</a> > <span id="post-24"><a href="http://

    Is there any way around this? I am teaching myself CSS at the same time as doing this so its all a bit confusing.

    Cheers
    Andy

    Line 68, column 27: ID "post-24" already defined

  2. This because both the breadcrumb plugin and your theme are creating identical id's you have two choices:

    1. Change the id used by the plugin for posts
    2. Change the id used by the theme for posts

    These can be achieved as follows:

    Plugin: Open up the breadcrumb-navigation.php file in an editor and find the following:
    <span id="post-<?php the_ID(); ?>">
    Replace it with:
    <span id="post-crumb-<?php the_ID(); ?>">

    Theme: Search the index.php in you theme for the following code:
    <h3 class="storytitle" id="post-<?php the_ID(); ?>">
    Replace it with:
    <h3 class="storytitle" id="post-title-<?php the_ID(); ?>">

    If you edit the theme you may have to check and modify other template files such as page.php if they exist.

    hope this helps

    westi

  3. franticorang
    Member
    Posted 6 years ago #

    Cheers Westi - not only was this the fastest post I have ever seen but it worked like a dream. I just have to edit the other pages now.

    Many, many thanks

    Andy

Topic Closed

This topic has been closed to new replies.

About this Topic