• Resolved RichardDawson

    (@richarddawson)


    I have been trying to include a line of links in a page of my wordpress blog, so that I can have sub-section links.
    I cannot seem to get it to work.

    The file I’m trying to include, has been tried in the root of my blog, and within the theme folder.

    The code I have tried in the page is:
    <?php include (TEMPLATEPATH . "/djlinks.php"); ?>

    <?php include ("./djlinks.php"); ?>

    The links in the file to be included do not appear in the page, under the page title.

    can anyone help?

    This is for the rejuvenation of my blog site:
    http://www.richarddawson.co.uk
    specifically the Dj’ing section.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter RichardDawson

    (@richarddawson)

    can anyone help?

    (when posting code you do not put the word “code” in backticks but the code itself!)

    You can NOT use PHP i the content of a Page or post.
    You must use the first line of code you posted in the template file!

    Thread Starter RichardDawson

    (@richarddawson)

    so php cannot be put in a post or page…

    Is there anyway of getting a line of sublinks at the top of a page that will be the same for all pages of that section?

    I know I can hard code the html for each page, but I’d like to be able to change the links for several pages by editing one thing, not several pages.

    any ideas how?

    php can can be used within a post or page if you use a plugin, look for exec-php or run php, I dont use either so I cant point you to them.

    Thread Starter RichardDawson

    (@richarddawson)

    I’ve tried this template method that was suggested in another forum…
    to use a “Unique Category template”
    http://www.webdesignerwall.com/tutorials/wordpress-theme-hacks/comment-page-12/

    I’ve now got it working how I want.
    I just need to move the content from the pages to the categories
    It’s easier to create posts in categories, rather than editing a page each time.

    As a test, I have commented out the code that shows the posts of the sub-categories on a parent category page (DJ’ing), and will put info general introductory info about my DJ’ing
    The sub pages will have posts, which will contain the content, in an easier to update way, rather than edit the page to add content.

    so I have put the php include statement in the unique category templates for each part.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP includes within a post on a page’ is closed to new replies.