Forums

[resolved] template tags question (10 posts)

  1. alankeys
    Member
    Posted 3 years ago #

    ive been looking at

    the_ID
    the_title

    Ive changed my page name to stuff.php in pretty permalinks

    Can someone tell me how to get get "stuff.php" on to the page ?
    the_ID tag doesnt seem to give the result ??

    thanks

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    Depends on your code, but in a 'typical' loop probably could use:

    echo $post->ID;
    echo $post->post_title;
  3. alankeys
    Member
    Posted 3 years ago #

    Michael

    Instead of "Stuff" on page, I am trying to get "stuff.php" (actual file name) and im just adding that code into header.php as a template tag.

    as in <?php the_title(); ?>

    if i put
    <?php
    echo $post->ID;
    echo $post->post_title;
    ?>

    into template i get

    1545
    Stuff

    Can you elaborate on how you would get "stuff.php" on page. (actual pretty permalink post page name).
    thanks

  4. MichaelH
    Volunteer
    Posted 3 years ago #

    Like this from wp-content/themes/default/index.php

    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
  5. alankeys
    Member
    Posted 3 years ago #

    Michael

    the post title is "stuff"
    the post number is "1545"
    but the actual post (page) name in "stuff.php"

    ( i set this up in pretty permalinks )

    Do you know how I can get "stuff.php" actually on page as a template tag ?

  6. MichaelH
    Volunteer
    Posted 3 years ago #

    Did you get a chance to look at the_permalink tag I used in the above example?

  7. alankeys
    Member
    Posted 3 years ago #

    yes

    it gives a link to "stuff.php"
    but the words on page are still "Stuff"

  8. MichaelH
    Volunteer
    Posted 3 years ago #

    Link to see problem required ;)

  9. alankeys
    Member
    Posted 3 years ago #

    Michael

    Thanks ever so much. I didnt put 2 and 2 together as I should have...
    what im really hoping to do is just call "stuff.php"

    The <?php the_permalink(); ?> returns http://domain.com/directory/stuff.php

    have you any ideas ?

  10. alankeys
    Member
    Posted 3 years ago #

    Michael

    In the end I did this with a routine to relate post number to "stuff.php"

    Thanks ever so much for your help.....

Topic Closed

This topic has been closed to new replies.

About this Topic