Implementing Directory Plugin on a custom theme

I'm trying to install and configure the Directory plugin on an existing site that already has a custom theme. I'd like the site to host a directory where logged in users can post a directory listing. The admin can then approve that listing and it would appear in the directory listing.

After installing and configuring, I'm left scratching my head trying to figure out a few things:

1) How do I output a list of categories or taxonomies on a page that link to a list of directory posts for that category/taxonomy? Is there a shortcode I can use?

2) I'm already using single.php for regular posts so I need to make a custom version of this to spit out the custom fields. How do I tell WP to use a custom single.php template as the template for single directory posts?

3) Is there an easy way to create a front-facing form for users to post a directly listing without going to the wp admin?

4) Can directory submissions by users (non-admins) be moderated or posted as "draft"?

Thanks!

    DavidM

    Hi coryshaw and welcome to WPMU DEV!

    1) How do I output a list of categories or taxonomies on a page that link to a list of directory posts for that category/taxonomy? Is there a shortcode I can use?

    2) I'm already using single.php for regular posts so I need to make a custom version of this to spit out the custom fields. How do I tell WP to use a custom single.php template as the template for single directory posts?

    There's not a shortcode, but if you take a look at the integrated theme you can get a good idea for how to customize Directory to work with your theme. In particular, you can take a look in the the following folder:
    directory\themes\default\includes\functions

    There are two files which you could perhaps copy into your theme's folder to use the functions:
    loop-functions.php
    theme-functions.php

    This topic was also addressed in a prior thread at the following, which provides a bit more insight:
    https://premium.wpmudev.org/forums/topic/customization-of-my-theme-to-work-with-directory-plugin

    3) Is there an easy way to create a front-facing form for users to post a directly listing without going to the wp admin?

    You may be able to achieve that with Gravity Forms or TDO Mini Forms but I haven't tried that myself, as yet. There are other plugins that attempt to bring back-end posting functionality to the front-end as well, though these two are the main ones I've heard of.

    4) Can directory submissions by users (non-admins) be moderated or posted as "draft"?

    I believe you may be able to achieve that by editing the roles so that the Directory Member (the integrated Directory role) cannot publish, but can only create drafts. Basically, you'd be looking for the "publish listings" capability and you may be able to do this easily using the following:
    http://wordpress.org/extend/plugins/user-role-editor/screenshots/

    Cheers,
    David

    Philip John

    Hiya!

    The Directory plugin adds a new custom post type called "directory_listing" so you should be able to....

    1) How do I output a list of categories or taxonomies on a page that link to a list of directory posts for that category/taxonomy? Is there a shortcode I can use?

    Use wp_list_categories using the taxonomy names you add to Directory in the "taxonomy" parameter. E.g.

    <?php
    wp_list_categories('taxonomy=category');
    ?>

    I don't know of a way to do this with a shortcode but this plugin does go a long way and you can probably customise it from there.

    2) I'm already using single.php for regular posts so I need to make a custom version of this to spit out the custom fields. How do I tell WP to use a custom single.php template as the template for single directory posts?

    It should be as simple as adding a new template file to your theme called single-directory_listing.php. You could just copy your existing single.php to create that and then modify to your desire.

    3) Is there an easy way to create a front-facing form for users to post a directly listing without going to the wp admin?

    You might want to check out Posthaste which allows you to integrate a new post form to your theme.

    4) Can directory submissions by users (non-admins) be moderated or posted as "draft"?

    This should be easy to achieve. Simply set the default user role to contributor and all posts will have to be reviewed before they can be published.

    Cheers!
    Phil

    coryshaw

    Ok I'm getting there. Your comments have put me on the right track.

    Here's where I'm currently stuck:

    1)
    I want to display some of the custom fields metadata on the taxonomy page under the title. Using the "embed code" only works on the single page. On the taxonomy page the following outputs nothing:

    <?php echo get_post_meta( $post->ID, '_ct_text_4da8dac7bc776', true ); ?>

    What can I use in the loop to output custom field data?

    2)
    I deleted the directory post type and added my own, but now when I click on the "Add listing" button, I get an "invalid post type" error because the form submit is still using the original directory post type. I can t seem to find the code where I can update that. Any ideas?

    Thanks again for your help

    coryshaw

    on the taxonomy.php page I'm calling <?php wpmu_directoryloop(); ?>

    In the loop I've just added the custom fields under "Contact Info", which output nothing...all I see is the title :

    function wpmu_directory_loop(){
    		rewind_posts();
    
    		global $wp_query;
    		while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    						<div class="entry-post">
    					<h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', THEME_TEXT_DOMAIN ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    					<p>
    
    				<h2>Contact Info</h2>
    				<p>
    					 <?php echo get_post_meta( $post->ID, '_ct_text_4da8da9f9f7e8', true ); ?>
    					<?php echo get_post_meta( $post->ID, '_ct_text_4da8db092a76f', true ); ?>
    					<a>ID, '_ct_text_4da8db1f9a12b', true ); ?>"><?php echo get_post_meta( $post->ID, '_ct_text_4da8db1f9a12b', true ); ?></a>
    				</p>
    
    				<h2>Address</h2>
    				<p>
    					<?php echo get_post_meta( $post->ID, '_ct_text_4da8dabb0a0a2', true ); ?>
    					<?php echo get_post_meta( $post->ID, '_ct_text_4da8dac7bc776', true ); ?>, <?php echo get_post_meta( $post->ID, '_ct_text_4da8dad697614', true ); ?>
    					<?php echo get_post_meta( $post->ID, '_ct_text_4da8daef872d0', true ); ?>
    				</p>
    
    				<h2>Description</h2>
    				<p><?php echo get_post_meta( $post->ID, '_ct_textarea_4da8db7df146f', true ); ?>
    				</p>
    
    			<?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    					<div class="entry-summary">
    		                <?php the_post_thumbnail( array( 50, 50 ), array( 'class' => 'alignleft' )); ?>
    
    						<?php the_excerpt(); ?>
    					</div><!-- .entry-summary -->
    			<?php else : ?>
    					<div class="entry-content">
    
    						<?php the_content( __( 'Continue reading <span class="meta-nav">?</span>', THEME_TEXT_DOMAIN ) ); ?>
    						<?php //wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', THEME_TEXT_DOMAIN ), 'after' => '</div>' ) ); ?>
    					</div><!-- .entry-content -->
    			<?php endif; ?>
    
    					<div class="clear"></div>
    					</div>
    				</div><!-- #post-## -->
    
    				<?php //comments_template( '', true ); ?>
    
    		<?php endwhile; // End the loop. Whew. ?>
    
    		<?php /* Display navigation to next/previous pages when applicable */ ?>
    		<?php if (  $wp_query->max_num_pages > 1 ) : ?>
    						<div id="nav-below" class="navigation">
    							<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">?</span> Older posts', THEME_TEXT_DOMAIN ) ); ?></div>
    							<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">?</span>', THEME_TEXT_DOMAIN ) ); ?></div>
    						</div><!-- #nav-below -->
    		<?php endif;
    }
    add_action('wpmu_directoryloop', 'wpmu_directory_loop');