Search Results for '"wordpress'
-
Search Results
-
Is it possible to integrate a bbpress forum into an existing site (so i don’t have to mess around with making a theme for bbpres) by using php functions? I am not very good (that is an overstatement) at php. I followed a tutorial that let me integrate a wordpress blog into my site, and this is the code it gave me
<?php define('WP_USE_THEMES', false);
require('wordpress/wp-blog-header.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div id="stage">
<div id="sidebar">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar() ) : ?>
<h3>Categories</h3>
<div id="blog-categories">
<ul>
<?php
list_cats(FALSE, '', 'ID', 'asc', '', TRUE, FALSE, TRUE,
TRUE, TRUE, FALSE, FALSE, '', FALSE, '', '', '', TRUE);
?>
</ul>
</div>
<br />
<div id="blog-archives">
<h3>Archives</h3>
<ul>
<?php get_archives('monthly', '', 'html', '', '','TRUE'); ?>
</ul>
</div>
<hr />
<br />
<div id="rss-links">
<h3><a href="<?php bloginfo('url'); ?>?feed=rss2">RSS feed</a></h3>
</div>
<?php endif; ?>
</div>
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div id="unique-entry-id-<?php the_ID(); ?>" class="blog-entry">
<div class="blog-entry-title"><?php the_title(); ?></div>
<div class="blog-entry-date"><?php the_time('Y-m-d G:i'); ?> |
<span class="blog-entry-category"><?php the_category(', '); ?></span> |
<span class="blog-entry-permalink"><a href="<?php the_permalink(); ?>">Permalink</a></span> |
<span class="blog-entry-language">
<?php if(function_exists('lp_other_langs')) {
//display existing language versions of the post
lp_other_langs(' ','', '', '', '');
}?></span>
</div>
<div class="blog-entry-body"><?php the_content(); ?></div>
<div class="blog-entry-comments">
<?php edit_post_link(__('Edit This')); ?> |
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'), "",
__('Sorry, comments are closed for this item.')); ?>
</div>
</div>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php else : ?>
<h2><?php _e('Not Found'); ?></h2>
<p><?php _e('Sorry, but no posts matched your criteria.'); ?></p>
<form method="get" class="searchform" action="<?php bloginfo('home'); ?>/">
<div>
<input type="text" size="20" value="<?php echo wp_specialchars($s, 1); ?>" name="s" class="s" />
<input type="submit" class="submit" value="<?php _e('Search'); ?>" />
</div>
</form>
<?php endif; ?>
<div style="text-align:center;">
<?php posts_nav_link(' — ', __('« Previous Page'), __('Next Page »')); ?>
</div>
</body>
what would i have to do to get bbpress integrated into my site? I heard somewhere that the function names are very similar to wordpress, so what code would i put in to get the forum categories then the recent posts, etc.?
So I’ve been digging further into the strange behavior I’ve had with slashes in posts AND with HTML tag attributes being yanked out.
It’s all related. Apparently, there is some type of problem where slashes get added TWICE when the WP intergation is on. This is why slashes start showing up everywhere and why kses fails.
I finally discovered that even though the stripslashes filter is called before bb_filter_kses, there are still slashes in front of the quotes of the attributes. So they get tossed.
So I took out all the stripslashes hacks I had put into the title and post routines and called stripslashes TWICE as a pre_post filter. Voila – attributes are preserved.
add_filter('pre_post', 'stripslashes', 40);
add_filter('pre_post', 'stripslashes', 45); // 2nd Time
I also added this little section in default-filters.php:
// Slash problems when integrated with WordPress
if (defined('WP_BB') && WP_BB) {
add_filter('post_text', 'stripslashes');
add_filter('get_topic_title', 'stripslashes');
add_filter('get_bb_title', 'stripslashes');
add_filter('edit_text', 'stripslashes');
}
And it stripped out the slashes in titles, browser bars, posts, edit screens, etc. (Note there is a missing semi-colon after the sort_tag_heat_map line – you need to add on if you put this at the end)
This is still a hack. I don’t have magic quotes on. I still need to dig and find out why there seems to be alternate behavior when wordpress is integrated or not. Maybe WordPress is turning on magic quotes and bbPress doesn’t expect it to be on?
Still digging.