News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Having issues integrating wordpress header into SMF

Started by ProwlingCat, July 04, 2011, 03:26:49 AM

Previous topic - Next topic

ProwlingCat

Edit: Ignore this post, scroll down to my second post. Most of the issues in this post are solved, but I ran into more issues.

I've done a lot of integration with wordpress and external sites and I just can't figure out how to fix this issue.

Over at segabits.com [nofollow] we have featured articles on the header, that's the only reason I want to integrate the header directly, otherwise I would just do it manually with HTML code.

Well, I've been tinkering with this for hours and these are the ends I'm stuck at:

I can randomly drop the code into the top or bottom of the index.php file for the root directory of SMF and this is what happens:
http://i.imgur.com/XBzt4.png [nofollow]

Which is good and bad at the same time. It's great that it's including the header! I only want it to include it once though.. but the thing is, when I try to include the header in a logical way so it only appears once it directs me to a non-existant wordpress install in the SMF directory.

Here are solutions I have tried that all lead me to the non-existant install directory:
- Including the code right after the body tag in index.template.php
- Creating a function called wpHeader(); with the code in index.php and calling it in index.template.php
- Including the code in the beginning of the smf_main(); function in the index.php file

the code in question that I'm talking about:
define('WP_USE_THEMES', false);
require_once('/path/to/blog/wp-blog-header.php');
require_once('/path/to/blog/wp-content/themes/segabits2/header.php');


The wordpress blog is installed in the /home/blog/ directory and SMF is installed in /home/smf/ directory. I was thinking maybe that could be an issue, but I wanted to see if other people thought it could be before I go crazy and move everything.

I mean seriously XD this is making me pull my hair out. XD. I'm hoping I can get an answer here, but if not I'll try the wordpress forums... *prays*

Oh, and sorry if this was the wrong forum to post this topic in. It just seemed the most appropriate.

ProwlingCat

Alright well... I got the template issues sorted out, but now I've ran into different problems. The problems I'm running into now are that the featured images don't load, and I can't login, some kind of cookie problem according to SMF.

Look for yourself: http://segabits.com/smf/index.php [nofollow]

Anyways, this is the current situation I got going...

index.php
require_once('/path/to/blog/wp-blog-header.php');
right before
$forum_version = 'SMF 2.0';

and...

index.template.php
require('/path/to/blog/wp-content/themes/segabits2/headerForums.php');
right after
function template_body_above()
{
global $context, $settings, $options, $scripturl, $txt, $modSettings;


here is the code i use to fetch featured images with in wordpress, for some reason it's not working when embedded into SMF:
<?php 
include('/path/to/blog/wp-content/themes/segabits/functions.php');
query_posts('cat=814&showposts=6'); ?>

<?php while(have_posts()) : the_post(); ?>
<div class="featuredBox">
<a href="<?php the_permalink() ?>">
<?php $key="featured_pic" ?> 
<?php echo '<img width="144" height="80" src="' get_post_meta($post->ID$keytrue) . '" />' ?>
<?php the_title(); ?>
</a></div>

<?php endwhile; ?>
<?php wp_reset_query(); ?>


anyways yeah ^^;;; that's my current issue.. I hope this makes more sense.. i was pretty tired yesterday when I made that other post and probably made no sense.

Kindred

that is because SMF uses the php standard notation, not php notation on every single line...
you'll have to get rid of all the crap <?php and ?> tags.

Also, you should consider the global header.footer mod instead of editing index.template.php directly...
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: