WordPress.org

Forums

Post ID (7 posts)

  1. Maxxim
    Member
    Posted 2 years ago #

    Hello,

    When you click on a permalink in Home Page, where is the post id saved? what function can request this ID? thank you.

  2. within the loop on the home page, the post ID should be gettable with:
    http://codex.wordpress.org/Function_Reference/get_the_ID

  3. Maxxim
    Member
    Posted 2 years ago #

    thank you, follow-up question:

    How do i change it so the post i clicked on opens a different page, not the default /?p=ID, but my own mypage.php?p=ID?

  4. can you elaborate on your question:

    - do you want to use a different single post template (for all or some single posts)?
    - or link to a different template individually per post?

  5. Maxxim
    Member
    Posted 2 years ago #

    I want to use my own template for all single posts.
    When i click on a post in homepage i want it to link to this template.

  6. I want to use my own template for all single posts.

    assuming the your currently used theme does not have one already, create a single.php template;

    per http://codex.wordpress.org/Template_Hierarchy this single.php would be used to show the single post when you click on the link on the home page.

  7. Maxxim
    Member
    Posted 2 years ago #

    I have wordpress installed under /blog directory, can i have single.php outside this directory?

    Thank you very much, i have accomplished what i was looking for, my only problem is that using rewrited permalinks (%year%/%postname%) does not load my css file. When i switch to Default permalinks works fine.

    Looking at the links it tries to load /2013/cssfiles...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.