WordPress.org

Ready to get started?Download WordPress

Forums

Having issues integrating wordpress header into SMF (2 posts)

  1. ShadiNeko
    Member
    Posted 2 years ago #

    I tried posting this topic on the SMF forums yesterday but haven't gotten a response yet, so I figured I'd try posting it here.

    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 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 smf index.php file for the root directory of SMF and this is what happens:
    http://i.imgur.com/XBzt4.png

    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.

  2. ShadiNeko
    Member
    Posted 2 years ago #

    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

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

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

    and...

    SMF 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, $key, true) . '" />' ?>
    <?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 when I made that other post and probably made no sense.

Topic Closed

This topic has been closed to new replies.

About this Topic