Support » Plugins » Hacks » Add WP Code to Non-WP Site

  • 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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • 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.

    Thread Starter Dave LeDev

    (@dave-ledev)

    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.

    Thread Starter Dave LeDev

    (@dave-ledev)

    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');
    	}
    ?>
    Thread Starter Dave LeDev

    (@dave-ledev)

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add WP Code to Non-WP Site’ is closed to new replies.