Skip to:
Content
Pages
Categories
Search
Top
Bottom

How-To: Add a directory page to your component


  • Anonymous User 96400
    Inactive

    @anonymized-96400

    Hey,

    for a jobboard component I’m writing at the moment I needed a directory, just like the members or blogs directory. It took me a while to figure out how to get that page to display, so I thought I’d share what I ound out.

    This little mini tutorial assumes you have a basic understanding of how a component is structured. If not, the skeleton component is an excellent starting point and I’d suggest you have a look through that first, at least the main plugin file.

    The first thing to do is register our component as a root component, which means that you have pages outside your normal /members/username/ path. The way I have set the component up is that every group gets their very own jobboard, using the groups api. Then I have a directory page where all the jobs from all groups get collected and displayed and this page I want to show at http://yourdomain.com/jobboard/. That makes my component a root component.

    I register it using this function, which resides in the main plugin file:

    function jobboard_setup_root_component()
    {
    bp_core_add_root_component( JOBBOARD_SLUG );
    }
    add_action( 'plugins_loaded', 'jobboard_setup_root_component', 2 );

    Then, directly after it, I load the template:

    function jb_directory_jobboard()
    {
    global $bp;

    if ( $bp->current_component == $bp->jobboard->slug )
    {
    $bp->is_directory = true;

    do_action( 'bp_core_action_directory_jobboard' );
    bp_core_load_template( apply_filters( 'jb_directory_jobboard', 'directories/jobboard/index' ) );
    }
    }
    add_action( 'wp', 'jb_directory_jobboard', 2 );

    In my theme folder I have added another folder directories/jobboard. In this folder I then put the index.php and the jobs-loop.php files that hold the actual HTML code for the directory page.

    And that’s about it.

    Enjoy,

    Boris

Viewing 3 replies - 1 through 3 (of 3 total)

  • wordpressfan
    Participant

    @wordpressfan

    Interesting. Please let us know of your progress. I can certainly see uses for such a component.


    21cdb
    Participant

    @21cdb

    I was looking at http://www.dailywp.com/jobpress-wordpress-theme/ which is in use at http://jobs.smashingmagazine.com/. I was wondering if it was compatible with WPMU and Buddypress.

    I would definitely interested in ur jobboard component!


    Anonymous User 96400
    Inactive

    @anonymized-96400

    Hey,

    yeah, I had a look at JobPress, but didn’t really like it. In the end I developed my own jobboard theme (http://test.jobboardr.com). It’s still in alpha at the moment and isn’t available for download yet. I develop the BP jobboard after that theme, though, so, for example, the component will include a basic API that allows group admins to display posted jobs on their external webpages.

    I think a joboard plugin that works together with the groups works much better than a theme, although it probably depends on what you need that functionality for.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How-To: Add a directory page to your component’ is closed to new replies.
Skip to toolbar