WordPress.org

Ready to get started?Download WordPress

Forums

Add WP Code to Non-WP Site (5 posts)

  1. Dave LeDev
    Member
    Posted 1 year ago #

    The goal is to add WordPress's header and footer to a different directory of my website that does not run on WordPress but another software. I'm aware of bridges for Joomla! and whatnot, but FreshStoreBuilder does not yet have a bridge. Both softwares are sharing the same database so passing information shouldn't be a problem there, but I'm too weak in PHP to know what I need to add to get headers and footers to show properly. It is HIGHLY preferred that I avoid iframes. Any ideas?

  2. bythegram
    Member
    Posted 1 year ago #

    This might help:

    I'm not familiar with FresshStoreBuilder but if you can add this code to the header of the pages it creates add this line:

    <?php require( 'YOURWORDPRESSDIRECTORY/wp-load.php' ); ?>
    Then you can use
    <?php get_header(); ?>
    and
    <?php get_footer(); ?>

    where ever you need them. You can even do queries and other WP functions.

  3. Dave LeDev
    Member
    Posted 1 year ago #

    Looks like FreshStoreBuilder has implemented the use of Smarty in their latest version, so that'll take a little bit to figure out. I greatly appreciate the lines of code!! I'll let you know if I get this working.

  4. Dave LeDev
    Member
    Posted 1 year ago #

    Hmm, I'm getting thrown this error:

    Fatal error: Call to a member function get() on a non-object in /home/iconicga/public_html/wordpress/wp-includes/query.php on line 27

    Here's the code I added in Smarty, maybe you can see a syntax error or something:

    /home/iconicga/public_html/library/smarty/plugins/function.wp_incl.php

    <?php
    
    	/*
    	 * Smarty plugin
    	 * -------------------------------------------------------------
    	 * File:     function.wp_incl.php
    	 * Type:     function
    	 * Name:     wp_incl
    	 * Purpose:  enables WordPress coding
    	 * -------------------------------------------------------------
    	 */
    
    	function smarty_function_wp_incl($params, &$smarty)
    	{
    		require('/home/iconicga/public_html/wordpress/wp-load.php');
    	}
    ?>
  5. Dave LeDev
    Member
    Posted 1 year ago #

    Hm, definitely some kind of conflict with Smarty and/or FSB. Created a test.php with the provided code, and works fine.

Topic Closed

This topic has been closed to new replies.

About this Topic