Search Results for '+.+default+.+'
-
Search Results
-
Topic: Ubuntu India Forum redesign
Hi guys first of all thanks to _ck_ for wonderful plugins. We at Ubuntu India have put up or new forum theme which had been using the kakumei theme ever since it came up. Check out or new theme , designed on default Kakumei.
I hope you like it ,comments ( good or bad ) are welcome.
I have seen many people asking that tags are not getting deleted in bbPress 1.0 (Even I faced the same problem, but it was working in the default theme). So I just thought of writing a solution for it.
Open the topic-tags.php of your theme.
You would find something like this:
<?php if ( $public_tags ) : ?>
<div id="othertags">
<ul id="yourtaglist">
<?php foreach ( $public_tags as $tag ) : ?>
<li id="tag-<?php echo $tag->tag_id; ?>_<?php echo $tag->user_id; ?>">
<a href="<?php bb_tag_link(); ?>" rel="tag"><?php bb_tag_name(); ?></a> <?php $tags = bb_get_tag_remove_link (); if ($tags) echo '<small>'.$tags.'</small>'; ?>
</li>
<?php endforeach; ?>
</ul>
</div>Replace it with:
<?php if ( bb_get_topic_tags() ) : ?>
<?php bb_list_tags(); ?>That’s it!
You can also view the changes to topic-tags.php of the default theme in the trac:
OK, here’s the functions.php file that I created in my theme to reproduce the drop down menu I had on my WordPress side.
Please note that this code does not attempt to reproduce all of the functionality of the WordPress wp_list_pages() function. Rather, it just tries to create the HTML needed for the drop down menu code that came with my WordPress theme to work. If you need anything more than that, feel free to modify this or strike out on your own.
Overview
Before the code, just a quick overview of how it works.
The function bb_list_pages() is a recursive function that returns a string containing the HTML for all of the pages that descend from a particular ancestor. The process is started by calling it with a parent ID of 0. The way the wp_posts table in WP is designed, this returns the highest level.
The function calls a helper function called get_pages() to retrieve the list of child pages from the database. It then loops through all of the pages returned by get_pages() & constructs the list item & anchor tags. It then calls itself to build the HTML for any descendants of the current page.
Here’s the code:
<?php
/**
* This file contains useful functions that can be called in any of the template's files.
*
* Version 1.0
* Date: 23-July-2009
* Author: Tony Vitabile
*/
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "/".$_SERVER["SERVER_NAME"];
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= ":".$_SERVER["SERVER_PORT"];
}
$pageURL .= $_SERVER["REQUEST_URI"];
return $pageURL;
}
/**
* Compute the name of the WordPress pages table & return it
*/
function pages_table() {
global $bb;
// Compute the name of the table we need to query
$table = $bb->wp_table_prefix;
if ($bb->wordpress_mu_primary_blog_id != "")
$table .= $bb->wordpress_mu_primary_blog_id."_";
$table .= "posts";
return $table;
}
/**
* Retrieve a list of pages from the WordPress posts table whose parent has the ID
* passed to this function.
*
* @param int $parent ID of the page that is the parent of the ones we're searching for
* @return array List of pages matching defaults or $args
*/
function get_pages($parent = 0) {
global $bbdb;
// Compute the name of the table we need to query
$table = pages_table();
// Build our query string
$parent = (int) $parent;
$query = "SELECT * FROM {$table} WHERE post_type = 'page' AND post_status = 'publish' AND post_parent = {$parent} ORDER BY menu_order";
// Get an array of rows back from the database
$pages = $bbdb->get_results($query);
// Return whatever we got back to the caller
return $pages;
}
/**
* Simple function to recursively scan the WordPress posts table looking for pages.
* It builds a string consisting of <ul><li></li>...</ul> items.
*
* @param int $parent ID of the parent page. 0 = no parent
* @param int $depth How far down in the heirarchy to go
* @param string $thisPage The name of the page that is currently being displayed
* @returns string A <ul><li></li>...</ul> list of page navigation information
*/
function bb_list_pages($parent = 0, $depth=0, $parent_uri='', $indent=' ') {
// Initialize the output of the function
$output = "";
// Is the depth = 0?
if ($depth == 0) {
// It is. Return the empty string now
return $output;
}
// Get the child rows of $parent
$pages = get_pages($parent);
// Did we get any pages back?
if ( empty($pages) ) {
// No, we didn't. Return the empty string now
return $output;
}
// Yes, we got pages back. Loop through all of the pages in our results
foreach ( $pages as $page ) {
// Compute this page's URI
$page_uri = $parent_uri;
if (substr($page_uri, -1) != '/')
$page_uri .= "/";
$page_uri .= $page->post_name . "/";
// Build the <li> tag
$output .= "{$indent}<li class="page_item page-item-{$page->ID}";
if ($page_uri == curPageURL() ) {
$output .= " current_page_item";
}
$output .= "">";
// Now build the rest of this item's information
$output .= "<a href="{$page_uri}">".$page->post_title."</a>n";
if ($page->ID > 0) {
// Get this page's children recursively
$kids = bb_list_pages($page->ID, $depth -1, $page_uri, '', $thisPage, $indent . " ");
// Does this page have any children?
if ($kids <> "") {
// It does. Add the information for the kids surrounded by <ul></ul> tages
$output .= "{$indent}<ul>n" . $kids . "{$indent}</ul>n";
}
}
// Output the closing </li>
$output .= "</li>";
}
// Return the string to the caller
return $output;
}
?>Tony
Topic: Role = Main?
Googled, searched the forum, it’s hard to create a specific search for something like the above without getting irrelevant results..
Had a dig and couldn’t find the answer….
bbPress 1.0
I’ve noticed throughout the default themes are references to..
role="main"
Firstly, what does this do? .. In some cases removing this from a template file reseults in the file not working.
Secondly, is there an alternative, these lines are causing invalidtions.
It’s not the end of the world, i can live with them, but some info on what they are for would be most helpful, if one of you lovely chaps could help..
As a side question, and this one again isn’t a huge problem, i find tabbing in code in certain files causes T_ error messages, T_SWITCH, T_CASE, depending on where and what i’m editting.. I like to indent the code appropriately when i’m working on it, but as said i simply can’t do this with particular template files..
Any ideas on that one?
I’m using Notepad++ and Notepad2 for editting, same programs i use for modifying WordPress. I’m using the correct encoding, transfer type etc… i’m use to handling code..
I got tired of waiting for error pages that don’t crash the user into the default bbPress theme and logo so here’s a plugin that makes an empty post error message actually stay within your custom theme. I’ll make it into a formal plugin as soon as I make it a bit more robust.
Let me know of other common error pages and I will see if they can be addressed via plugin vs a core hack.
(direct download, save as
themed-error.php
)