Directory Plugin

How do I use this plugin as an application and call it in a page or use it as menu item?

  • Mason

    Hiya tblrg,

    How do I use this plugin as an application and call it in a page or use it as menu item?

    The directory plugin is most easily set up by using the plugin in combination with the default theme. However, this does mean that the entire site becomes a 'directory'. There are a couple ways around this including setting your front-page to a different page of the theme (under Settings>Reading in WP Admin) or creating your own child theme from the 'default' one included with directory.

    Does that help? If you tell us a bit more about what you want to accomplish, we may be able to provide some further guidance for you here.

    Thanks!

  • Mason

    Hiya tblrg,

    Well, to be honest, custom integration like this is going to be quite a bit of work. To get it perfect you should be prepared to spend a bit of time on this or hiring a developer to do it for you.

    Here's an outline of what you'd want to do:
    1. Create a page template (call it page-directory.php for example) and put it in your theme's root directory. The contents should be the same as the directory's home page. It'll look something like this:

    <?php
    /**
     * Template Name: Directory Page
     *
     * Selectable from a dropdown menu on the edit page screen.
     */
    ?>
    <?php get_header() ?>
    <div id="content"><!-- start #content -->
    	<div class="padder">
    		<ul>
        <?php dp_list_categories('home'); ?>
    </ul>
    	</div>
    </div><!-- end #content -->
    <?php get_footer() ?>

    2. Now, we need to copy a few directory-specific bits into the theme as well. Add the following two files to your theme (copy them from the directory theme and put in the same directory in your theme:
    theme_root/includes/core/theme-core.php
    theme_root/includes/functions/theme-functions.php

    3. Add the references to these files in your theme's function.php file:

    include_once 'includes/core/theme-core.php';
    include_once 'includes/functions/theme-functions.php';

    4. Save everything. Now, let's create a new page in WordPress. Call it whatever ya like (Directory) for example) and just leave it blank. Under Page Template under the Publish button you should see a new option for 'Directory Page' if you copied the lines exactly from step one. Select this and click publish.

    5. Add this new page to your custom menu and take a look. You'll have a tag and category listings on the new page.

    6. The final bit is to add in the custom CSS elements to help with the directory look and keep things matching with your theme. Again, go to the directory theme and look in the CSS directory. Copy the styles you'd like to use into your new theme. Fortunately, you can dictate that the styles only take place where you like them. Since we're no longer using the styling on our home page, we'll want to change that.

    For example, if I want a grid layout for my listings, I'd open directory/css/home-grid.css and copy the styles there. I need to change them to use the unique body class of our directory page. In the above scenario I'd go from this:

    .home #content li ul, .archive #content li ul {
    margin: 0 !important;
    border: none;
    }

    to this:

    .page-template-page-directory-php #content li ul, .archive #content li ul {
    margin: 0 !important;
    border: none;
    }

    Now, the real time comes into play as you go through each item and create the custom CSS you need for categories and single listings to suit your theme.

    Hope this helps get ya started. Like I said, it's doable, but to get it perfect it'll probably take some time.

    Thanks!