Search Results for 'code'
-
Search Results
-
Topic: Changing color of wrapper.
When I use the code below to change the color of the wrapper on the stock theme, the wrapper itself disappears. How do I fix that? Below is the code for the wrapper used in the CSS. I am just uploading a new file with the color I want and call it “page_header_tile1.png” and it takes off the old one without adding the new one.
#wrapper {
background: #fff url('images/page_header_tile.png') repeat-x 0px -15px;
}Thank you.
http://www.liuso.com/bbpress this is my forum address
I try reupload a new rss.php file again but doesn’t working
# BEGIN bbPress
Options -MultiViews
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /bbpress/
.htaccess
RewriteRule ^page/([0-9]+)/?$ /bbpress/index.php?page=$1 [L,QSA]
RewriteRule ^forum/([^/]+)/page/([0-9]+)/?$ /bbpress/forum.php?id=$1&page=$2 [L,QSA]
RewriteRule ^forum/([^/]+)/?$ /bbpress/forum.php?id=$1 [L,QSA]
RewriteRule ^forum/?$ /bbpress/ [R=302,L,QSA]
RewriteRule ^topic/([^/]+)/page/([0-9]+)/?$ /bbpress/topic.php?id=$1&page=$2 [L,QSA]
RewriteRule ^topic/([^/]+)/?$ /bbpress/topic.php?id=$1 [L,QSA]
RewriteRule ^topic/?$ /bbpress/ [R=302,L,QSA]
RewriteRule ^tags/([^/]+)/page/([0-9]+)/?$ /bbpress/tags.php?tag=$1&page=$2 [L,QSA]
RewriteRule ^tags/([^/]+)/?$ /bbpress/tags.php?tag=$1 [L,QSA]
RewriteRule ^tags/?$ /bbpress/tags.php [L,QSA]
RewriteRule ^profile/([^/]+)/page/([0-9]+)/?$ /bbpress/profile.php?id=$1&page=$2 [L,QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/?$ /bbpress/profile.php?id=$1&tab=$2 [L,QSA]
RewriteRule ^profile/([^/]+)/([^/]+)/page/([0-9]+)/?$ /bbpress/profile.php?id=$1&tab=$2&page=$3 [L,QSA]
RewriteRule ^profile/([^/]+)/?$ /bbpress/profile.php?id=$1 [L,QSA]
RewriteRule ^profile/?$ /bbpress/profile.php [L,QSA]
RewriteRule ^view/([^/]+)/page/([0-9]+)/?$ /bbpress/view.php?view=$1&page=$2 [L,QSA]
RewriteRule ^view/([^/]+)/?$ /bbpress/view.php?view=$1 [L,QSA]
RewriteRule ^rss/?$ /bbpress/rss.php [L,QSA]
RewriteRule ^rss/topics/?$ /bbpress/rss.php?topics=1 [L,QSA]
RewriteRule ^rss/forum/([^/]+)/?$ /bbpress/rss.php?forum=$1 [L,QSA]
RewriteRule ^rss/forum/([^/]+)/topics/?$ /bbpress/rss.php?forum=$1&topics=1 [L,QSA]
RewriteRule ^rss/topic/([^/]+)/?$ /bbpress/rss.php?topic=$1 [L,QSA]
RewriteRule ^rss/tags/([^/]+)/?$ /bbpress/rss.php?tag=$1 [L,QSA]
RewriteRule ^rss/tags/([^/]+)/topics/?$ /bbpress/rss.php?tag=$1&topics=1 [L,QSA]
RewriteRule ^rss/profile/([^/]+)/?$ /bbpress/rss.php?profile=$1 [L,QSA]
RewriteRule ^rss/view/([^/]+)/?$ /bbpress/rss.php?view=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /bbpress/index.php [L]
</IfModule>
# END bbPress
After wrestling with integration between WP 2.8 and bbPress 1.0.2 for the last day and a half, I gave up and started thinking of ways I could do this a little more straightforwardly.
My problem was I didn’t need any sort of database or user sharing between the sites. I simply wanted a way to display certain parts of my WordPress theme on my bbPress page. Things like a list of the WP categories, a menu being built from categories, a blogroll, etc.
Here’s what I did:
Instead of fully integrating WP, what is usually called “deep integration” so as to gain access to WordPress functions (wp_list_categories, etc.), I simply created a few functions in my WordPress theme’s function.php file that automatically generate the HTML for the items I wanted, and then saved it to a file that I could then call in my bbPress theme.
Part 1: WordPress Theme
Open up your functions.php file in your WordPress theme’s folder (/wp-content/themes/yourtheme/).
Scroll down to the bottom and create your new function. For this example, I’ll use adding a list of categories from your WP blog to your bbPress forum:
function make_cats () {
$output = NULL;
$output = wp_list_categories('echo=0&orderby=ID&hide_empty=0&title_li=<h3>categories</h3>');
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/your-theme/ext/cats.html', 'w');
fwrite($fp, $output);
fclose($fp);
}
add_action('edit_category_form', 'make_cats');To explain this a bit, basically:
We create a variable called $output, NULL it (make sure it’s empty), and then load the category info into it. The wp_list_categories() function creates an unordered list of the categories with a heading (h3) saying “Categories”. We also use the echo=0 bit to make sure it don’t print the HTML it is generating to the screen, but rather just puts it in $output.
Then we open a file called cats.html in a new folder called ext that we’ve previously created (via FTP or whatever) in your theme directory (/wp-content/themes/your-theme). If the file doesn’t exists, the function will create it, however, the “ext” folder needs to already exist. The file is then fill it with $output. All these files and folders are completely up to you — you can save the file anywhere on your server, I just chose to stick it somewhere easy to remember and that wouldn’t clutter anything up.
The final step is:
add_action(‘edit_category_form’, ‘make_cats’);
This tells WordPress to run this function (make_cats) every time the edit_category_form action is triggered, basically any time you load your “Categories” page in the wp-admin area. There are lots of different actions for virtually anything you can think of. Find the one suitable for your customization here.
Part 2: bbPress Theme
The second part is to load the contents of your newly created HTML file in your bbPress theme. To do this only requires a single line of code inserted into the appropriate place in your theme. Wherever you want the list of categories (or whatever you’re wanting to display), simply add this line:
<?php include $_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/your-theme/ext/cats.html'; ?>That should do it.
Here are a couple more function examples, both use the “save_post” action, so every time you save (new or edit) a post, it fires and updates (or creates) the HTML files:
Tag Cloud
function make_tags () {
$output = NULL;
$output = wp_tag_cloud('echo=0&smallest=8&largest=22&number=30&orderby=count&order=RAND');
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/your-theme/ext/tags.html', 'w');
fwrite($fp, $output);
fclose($fp);
}
add_action('save_post', 'make_tags');Recent Blog Posts
function make_posts () {
$output = NULL;
$getsomeposts = new WP_Query('numberposts=10');
$output = '<ul>';
while ($getsomeposts->have_posts()) : $getsomeposts->the_post();
$output .= '<li><a href="'. get_permalink() . '" title="' . the_title('','',FALSE) . '">' . the_title('','',FALSE) . '</a></li>';
endwhile;
$output .= '</ul>';
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . '/wp-content/themes/your-theme/ext/posts.html', 'w');
fwrite($fp, $output);
fclose($fp);
}
add_action('save_post', 'make_posts');Hope that helps someone who is as frustrated with the WP<–>bbP integration as I was. If you have any questions about this, feel free to post ’em here. I’ll do my best to check back.
Hi, I’m using WP2.8 and bbP1.0.2. I’m looking to have access to WordPress’ functions, but do not need any cross-user abilities, so don’t need to wrestle with getting the cookies to jive or the user tables to sync.
Is this possible?
Currently I have:
if ( !defined( 'ABSPATH' ) ) {
include_once( '/pathtowp/wp-blog-header.php' );
}Where, obviously, ‘pathtowp’ is the proper path.
This work great and I have full access to WP’s functions for loading sidebars, categories, etc. However there seems to be something strange going on with the login.
If I am logged in before I enable the line above in my config file, everything is fine. If I am logged out, enable the above line and then try to log in, I get no joy. The page simply reloads as if I had never logged in (no password error or anything like that — just again displays the login box).
I am **guessing** this has something to do with some sort of conflict between bbPress’ login, and the login for WordPress? Maybe something goofy is happening with authentication? But I really don’t know.
If anyone has experienced this and could offer their advice, it would be much appreciated.
I’m running into an odd error:
Warning: mysql_real_escape_string(): 16 is not a valid MySQL-Link resource in /forums/bb-includes/backpress/class.bpdb.php on line 394This happens when I using an external function I made to create threads which uses bb_insert_topic. It seems to only happen ever other thread created. If I just create one thread, it never happens, if I create three threads in a row, it will happen on the second but not the first or third.
My function is fairly straight-forward:
$topic_id = bb_insert_topic(array('topic_title' => $topic_title,'topic_poster' => 5,'forum_id' => 1));Is this a bbpress bug?
Topic: Php help – Welcome Message
Okay – so I’m trying to change my Welcome MEssage on the home page. Right now it says:
“Welcome back Welcome, USERNAME!”
The code that produces this looks like this:
<?php if ( !in_array( bb_get_location(), array( ‘login-page’, ‘register-page’ ) ) ) login_form(); ?>
That’s utter gobbledy gook as far as I”m concerned. Can anyone decifer it? Why is “welcome” appearing twice? Where are the words coming from? Whay if I wanted it to say “Go away USERNAME”? Where is that php getting it’s information from?
Second line looks like this, which is fine:
“User Options: Admin | Log Out”
Since I’m admin, I assume that’s why I see admin. Other users would just see Log Out? or what? The code producing that is equally cryptic. Where does it come from? What if I wanted to, say, change the p class that gets slapped around that?
Thanks!
WordPress info:
I have wordpress Version 2.8.4 set up following these directions:
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
…so the wordpress folder is located here: http://www.example.com/cms/
…but the world sees the blog here: http://www.example.com/
I have permalinks set up with Day and name (a.k.a.: /%year%/%monthnum%/%day%/%postname%/)
bbPress info:
I installed bbPress 1.0.2 here: http://www.example.com/forums/
The problem:
I’m having some problems with this setup which I think are being caused by mod_rewrite.
I try to login at https://www.example.com/forums/ (using the login and password emailed to me after installation) and it seems to accept my login, but then tries to take me to this url: https://www.example.com/forums/forums/ and then shows a wordpress 404 not found page.
Any ideas?
Thanks very much in advance for any help!
Topic: Where do we report bugs?
