Support » Fixing WordPress » using template tags

  • I’m making an .php to control some side images on a site which maybe subject to alterations.

    I wanted to use <?php bloginfo(‘tempate_url’); ?> within this .php page but I’m having problems figuring out how. Is there a file that needs to be included within this file as well ?



Viewing 6 replies - 1 through 6 (of 6 total)
  • are you making a template for wordpress to use? Or is this a totally separate php file?

    If it’s a template for wordpress to use, you need to include the header telling it such:

    Template Name: Forum

    if it’s a separate php file, you need to include wordpress, something like:

    // Include WordPress
    define('WP_USE_THEMES', false);

    Its a file for the theme, I want to use it within an image and a link so:

    echo "<img scr='" bloginfo('template_url) "/images/image' />";

    Neither of what you suggested worked.

    I just want to have the file called – like you do a standard side bar- and utilise the shortcut codes for linking / filepathing.

    is there not a functions file I can just include? are looking for a way to call the file? I thought you were looking for a way to make the file function with WP….

    I’m not sure I understand you…but if that is what you are looking for then:
    <?php include (TEMPLATEPATH . "/yourfile.php"); ?>

    If I still don’t get it sorry…..I’m just not sure I understand your question

    No I can call the file fine within the theme. Let me try explaining again:

    I have a theme. The theme has standard header/index/sidebar/footer files.

    I want to add to this list another php file for some images which may get changed at a later date and rather than hard code them into the index I’d like to make another file.

    So my theme folder now has header/index/sidebar/footer/sideimages php files. What I want to do is use:
    <?php bloginfo('template_url') ?>

    I want to be able to use the bloginfo function within my new php file but I keep getting a parse error. What I’m asking is what do I need to include/require in my new page to get the wordpress functions to be recognised.

    So I want to make my page something like:

    echo "<img scr='" bloginfo('template_url') "/images/image' />";
    echo "<img scr='" bloginfo('template_url') "/images/image' />";
    echo "<img scr='" bloginfo('template_url') "/images/image' />";

    But I just get a parse error and therefore nothing loads.

    I’m still looking for help with this – I tried getting it to work as:

    define('WP_USE_THEMES', false);
    echo "<img scr='" bloginfo('template_url') "'/images/image /">;

    But that didnt work either (came one of the suggested links) I’m not new to php at all but I am new to wordpress and I don’t know where these functions are hidden to call them up.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘using template tags’ is closed to new replies.