WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get title from permalink (10 posts)

  1. vernikr
    Member
    Posted 7 years ago #

    How can I get post title having its permalink only?

  2. tsguitar
    Member
    Posted 7 years ago #

    Did you search anywhere before you posted this question? You'll get the answers much more quickly if you search either something like Google or the Codex.

    Having its permalink only?? As opposed to what else? I'm not quite sure what you mean.

    Here's how to display the title of a post:
    <?php the_title(); ?>

    Here's how to display the title of a post with a link to itself:
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>

  3. vernikr
    Member
    Posted 7 years ago #

    I want to print the title of page number 1 on the page number 2. I know only the permalink and the ID of page number 1. I expect function like this:

    GetTitle($my_permalink)

    or

    GetTitle($my_ID)

    Is there _any_ way to get title of non current page?

  4. tsguitar
    Member
    Posted 7 years ago #

  5. vernikr
    Member
    Posted 7 years ago #

    Yes... But how can I get the title of any post (not only previous or next)?

  6. tsguitar
    Member
    Posted 7 years ago #

    Does it need to by dynamic? You can't just type it out? If you know the ID and permalink, you obviously know the title, but that would mean you need to hand code it. Hrmm... Let me look around a bit.

  7. vernikr
    Member
    Posted 7 years ago #

    Yes, it is dynamic and I can't type it manually.

    I have a gallery. This gallery consits of sevaral pages (1, 2, 3 ...). On each page I want to have 5 links to some posts (link is a gellery item). But I can't write all links on each page manually. Instead of doing so I get the post ID's from some file. This file can contain only ID's or permalinks and can't contain titles of pages (if it could the would be no problem).

  8. tsguitar
    Member
    Posted 7 years ago #

    Here you go:
    http://wordpress.org/support/topic/69219?replies=3

    Actually, a quick Google search for "get post title for a specific post wordpress" found that as result #1. Did you search before you posted here? You would have found the answer much faster.

  9. vernikr
    Member
    Posted 7 years ago #

    Thanks a lot, tsguitar! Maybe I used search incorrectly.

  10. tsguitar
    Member
    Posted 7 years ago #

    Can you mark this topic "Resolved"? Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags