• Hi,
    this is my website http://www.mp3ojax.com.
    i want to insert permalinks on the images on main page
    This is the code:

    <a href="<?php the_permalink() ?>
    <?php endif; ?>
    <?php $metadataContent = ob_get_clean(); ?>
    <?php if (trim($metadataContent) != ''): ?>
    <div class="art-PostMetadataHeader">
    <?php echo $metadataContent; ?>
    </a>

    But I get urls like this:
    http://mp3ojax.com/joseph-krikorian-artarutyun-2008/%3C/a%3E%3C/div%3E%3Cdiv%20class=
    please can someone help me?

Viewing 4 replies - 1 through 4 (of 4 total)
  • From WordPress Answers (the link won’t work until at least August 18):

    There isn’t really enough code as an example to fully understand if there is any additional issues, but the main thing which is causing the URL’s to not work is the fact that the opening anchor tag is not closed. Adding a “> to the end of the first line should fix the issue. In addition the art-PostMetadataHeader div should be closed.

    <a href="<?php the_permalink() ?>">
    <?php endif; ?>
    <?php $metadataContent = ob_get_clean(); ?>
    <?php if (trim($metadataContent) != ''): ?>
    <div class="art-PostMetadataHeader">
        <?php echo $metadataContent; ?>
    </div>
    </a>

    Having said that, nesting a block level element such as a div inside of an inline element such as an anchor is not standards compliant, but this code would have the same effect of linking all the $metadataContent, while being standards compliant.

    <?php endif; ?>
    <?php $metadataContent = ob_get_clean(); ?>
    <?php if (trim($metadataContent) != ''): ?>
    <div class="art-PostMetadataHeader">
       <a>"><?php echo $metadataContent; ?></a>
    </div>
    Thread Starter karo91

    (@karo91)

    Thank you for your reply
    i have changed the code to this but still dont work

    <a href="<?php the_permalink() ?>">
    <?php endif; ?>
    <?php $metadataContent = ob_get_clean(); ?>
    <?php if (trim($metadataContent) != ''): ?>
    <div class="art-PostMetadataHeader">
    <?php echo $metadataContent; ?>
    </div>
    </a>

    Thread Starter karo91

    (@karo91)

    This is the code of the whole page that i got right now

    [Large code excerpt removed by moderator. Per forum rules, please use the pastebin for all large code excerpts. It works better anyway.]

    Thread Starter karo91

    (@karo91)

    I found it

    <a href="<?php the_permalink() ?>"><div class="art-PostContent">
    <?php if (is_search()) the_excerpt(); else the_content(__('Read the rest of this entry »', 'kubrick')); ?>
    
    </div></a>

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

The topic ‘Permalink Problems’ is closed to new replies.