WordPress.org

Forums

PHP in Pages (?!) (3 posts)

  1. Marcos Sader
    Member
    Posted 10 years ago #

    Hi, i am having a big problem trying to use php within pages.
    Is there any way to render php or even use the wp_tags inside pages.
    I mean that would be great no ned to worry anymore about dealing with plugins for static conten.
    What i'm trying to di is the following....

    <div id="links-single">

    <h2>Links:</h2>

      <?php get_links_list(); ?>

    </div>

    ...so by placing that code inside the apge we would get a page with our blogroll, i ask you: is there anyway to do it?

    If not, how do i call a page with that code inside the themes directory.
    For example i have...

    ...blogs\wp\13\wp-content\themes\themename\categories.php

    and i want to call that file... how can i do it?

    Thx in advance.

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    You can't, but you can.

    If you are trying to get WP to make the page, and putting the tags as the content to get your list, it will not work - WP messes the php somehow.

    But, if you create a standalone static page one that uses includes for the header / menu / footer (if needed) then the php will work as the WP engine doesn't touch it.

    http://www.tamba2.org.uk/wordpress has info on creating a static page in such a way that PHP can be included.

  3. Marcos Sader
    Member
    Posted 10 years ago #

    Ok, now i'm less stupid today i was so bored that i started playing again with my wip layout on my pc and after looking at the code of the default layout i found out a way to make static pages (no plugins required).
    The only thing to do is place this code at the top of the page.

    <?php /* wp_php functions in a "static page"*/
    require('.../wp-blog-header.php');
    ?>

    And then u can use the "get" functions or use the php includes like this...

    <?php include "mod-headear.php"; ?>
    <?php include "mod-sidebar.php"; ?>
    <?php include "mod-footer.php"; ?>

    hope it work for u too

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.