Custom Directory Pages? Why isn’t this code working?
-
I’m in the process of building a collection of plugins for my site, and want to replicate the directories as seen in blogs and groups for my custom content.
After carefully reviewing the code, I found the file bp-groups-directory-groups.php, and used it as a outline to build this sample file. the file doesn’t load correctly, it shows “The page you were looking for was not found. ” and “Sorry, that page was not found”. Here is my php code, hopefully it will post ok into the forum. I understand this a minimal example, but it should work? What am I missing?
/wp-content/mu-plugins/bp-sample.php
<?php
/*
* Created on Jan 13, 2009
*
* Project Buddypress Addons
*
* File bp-sample.php
*
*/
function samples_directory_samples_setup() {
global $bp, $current_blog;
$bp = array( ‘slug’ => ‘samples’ );
if ( $bp == $bp && $bp == ” ) {
add_action( ‘bp_template_content’, ‘samples_directory_samples_content’ );
add_action( ‘bp_template_sidebar’, ‘samples_directory_samples_sidebar’ );
if ( file_exists( TEMPLATEPATH . ‘/plugin-template.php’ ) )
bp_catch_uri(‘plugin-template’);
else
wp_die( __( ‘To enable the sample directory you must drop the “plugin-template.php” file into your theme directory.’, ‘buddypress’ ) );
}
}
add_action( ‘wp’, ‘samples_directory_samples_setup’, 5 );
function samples_directory_samples_content() {
echo “sample content”;
}
function samples_directory_samples_sidebar() {
echo “sample sidebar”;
}
?>
If I edit bp-groups-directory-groups.php, and change it to this:
add_action( ‘bp_template_content’, ‘gifts_directory_gifts_content’ );
add_action( ‘bp_template_sidebar’, ‘gifts_directory_gifts_sidebar’ );
You can see the results here:
http://gorgeousgamers.com/beta/groups
Now it shows the gifts, and not the groups. What is different, that my sample isn’t working? Any suggestions?
Thanks for any feedback
Brad
- The topic ‘Custom Directory Pages? Why isn’t this code working?’ is closed to new replies.