WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can't Echo a Link Properly to a Custom Post Type (2 posts)

  1. zoaCode
    Member
    Posted 1 year ago #

    This is the code I am working with:

    echo '<a href="' . bloginfo('template_directory') . $slug['slug'] . '">' . $post_type->labels->singular_name . '</a>' .$markup;

    I am trying to create a link to a slug named "Portfolio". It links to a page in the template directory not the blog directory. The above code does this but displays the entire URL string before the link in regular normal text. How may I hide the URL path properly?

    Exact example: http://www.blah.com/blah/blahPortfolio
    Where: `http://www.blah.com/blah/blah needs to be hidden.

  2. zoaCode
    Member
    Posted 1 year ago #

    I solved this myself with:

    echo '<a href="' . $slug['slug'] . '">' . $post_type->labels->singular_name . '</a>' .$markup;

    I have several blogs installed on the same domain and that was causing the problem. Just when you think you know everything ...:)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.