• Resolved Wizard

    (@badmp3)


    Greetings,

    I have created a page manually that is pulling data from a API with products and stuff ..

    But I dont know how to wrap around the WordPress Template so that page has the same look as the wordpress blog.

    Can someone lend a hand? What do I need to include on that file to bring up the wordpress template?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Something like this just before the </head> section should load the theme….I think? (assuming your WP is in a directory called blog, you may need to edit the path)

    <?php
    // Include WordPress
    define('WP_USE_THEMES', true);
    require('./blog/wp-load.php');
    ?>

    you then can use elements like your other templates do (call the header, sidebar, footer, etc)

    Thread Starter Wizard

    (@badmp3)

    How do you call the Header , sidebar, footers?

    Whats that syntax?

    you’ll see it in the theme you use….check out a file like index.php… (also, one thing I forgot, if the page you made is a .html page, you’d need to rename it to .php for the include code above to work)

    <?php get_header(); ?>
    gets the header

    <?php get_sidebar(); ?>

    gets the sidebar….you get the idea.

    Also if you want your page’s styling to match the rest of your site well, you may have to use the same classes/divs in places on your stand alone page…. (this is what would call in your actual css styles)

    —does your page need to be a standalone page? Like because of URL or something? Another option you have is to just make a page within WP, and make a custom page template in your theme by copying one of your templates (like page.php), deleting the loop, inserting your custom code, and assigning the template to the page you made

    Thread Starter Wizard

    (@badmp3)

    Hiya .. thnx for your help so far so good ..

    Here is what I have and its working great!

    <?php
    
    // Include WordPress
    define('WP_USE_THEMES', true);
    require('./../wp-load.php');
    
    get_header();
    get_sidebar();
    echo '<div class="postContent">';
    include('shop.php');
    echo '</div>';
    get_footer();
    
    ?>

    Now I have a issue with the <Title> tags

    Is there a way to change the Title tag with the above method?

    The URLS are coming out something like this:
    test.php/D-187/Accent_Lamps.html

    So I would write the Title D-187 Accent Lamps .. using the URL string and some text replaces.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Using Template / WP on external pages’ is closed to new replies.