Creating taxonomies in Custompress and categories in Directory

Alright, after spending an entire day on this madness, I felt the next best step would be to finally seek help with this situation. Here is my question:

After installing the newest version (as of 3/1/12) of both Directory and Custompress, I am struggling to understand the relationship between "Taxonomies" in Custompress and "Categories" in Directory. Do I need to create both Categories AND Taxonomies?

  • Kimberly
    • Champion of Loops

    Gary.Bailey@buildohio.net,

    Hi! and Welcome to WPMUdev forums!

    I just wanted to pop in and let you know I have installed both CustomPress and Directory on my test site and am looking around to better understand the relationship between the two, so that I can help you as much as possible :slight_smile:

    Are you having a particular issue or are you having trouble with the relationship of the two in general?

    Best,

    Kimberly

  • Kimberly
    • Champion of Loops

    Gary,

    Dropping off some notes.

    From what I see and read Directory already has CustomPress capability integrated with it. You shouldn't need to create both.

    The only thing you really need to use CustomPress for with Directory would be to add a New Field.

    My testing:

    If you create a new taxonomy and select directory_listing as the post type

    you end up with this taxonomy on the New Listing page in addition to the Category.

    This leads me to think that you can create Both taxonomies and Categories depending on your needs and that they are shown separately in the Post Type.

    However,

    I went into the exisiting taxonomy (CustomPress> Content Type > Taxonomies), opened classified_categories and added directory_listing as a post type

    and that created a Categories selector with all of my classified categories and, in the same column below was the Listing Categories selector.

    You CAN use both, but doesn't seem that it's necessary :slight_smile:

    Let me know if this helps, I'm enjoying the chance to dig around, I'm learning lots of new things as well :slight_smile:

    Best,

    Kimberly

  • Clifford P
    • The Bug Hunter

    https://premium.wpmudev.org/project/wordpress-directory/installation/ does state that CustomPress is integrated into Directories. However, I have plugged a custom field embed code all over the place in Directories' theme files and can't get the output. Where, exactly, do I need to put the custom field embed code to show up on the single listing page? Please provide full path, file name, and line#.

    Example CustomPress embed code:
    <?php echo get_post_meta( $post->ID, 'ct_Website_text_b801', true ); ?>

    Thank you.

  • Clifford P
    • The Bug Hunter

    I see it in the backend of Directory, but I can't get that code that I put up to echo/display onto the page of when displaying a single listing post.

    Should custom fields show up automatically?
    Or
    Which file(s) and where in those file(s) do I need to put each custom field's echo code?

    Thank you.

  • jloweezy
    • Site Builder, Child of Zeus

    Just to be somewhat helpful - Clifford, it won't show on the front end until you embed the code in one of your .php files through the Editor. The tricky part is knowing which one to paste it into... for me, when I put it in singlepost.php, it showed up on EVERY post rather than just the Directory Listings. I got frustrated and deactivated it all. The question is WHICH .php file you need to embed the code from your custom field creation in CustomPress.

    Hope this helps,

    Janet

  • Clifford P
    • The Bug Hunter

    @jloweezy
    That's what my initial question was - "where?"

    Then @KimberlyL said that's not needed.

    FYI: I was not attempting to input the custom field code into my theme's singlepost.php but instead within the plugin folder's theme file(s). But I never got it to show up on screen.

    Why can't I get an answer? grrr...

    Thanks! :slight_smile:

  • fitoussi
    • The Incredible Code Injector

    try this,
    if you open the "single-listing.php" file look between the lines 29 to 38 (might not be exactly for you but around there) should see somthing similar to this :

    <div class="entry-post">
    	<h1 class="entry-title"><?php the_title(); ?></h1>
    		<div class="entry-content">
    				<?php the_content(); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', THEME_TEXT_DOMAIN ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->
    		<div class="clear"></div>
    			</div>

    just under "the_content" paste your code. for example :

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

    that should work.

  • Clifford P
    • The Bug Hunter

    The good news: I'm not an idiot. That's exactly where I tried.
    The bad news: I haven't gotten it to work. grrr.... I really appreciate your help.

    This shows I have the custom field within the Directory listing admin page: http://ScrnSht.com/wpelcu

    This is the single-listing.php code, with my single custom field embed code:

    <div class="entry-post">
    <h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="entry-content">
    <?php the_post_thumbnail( array( 275, 100 ), array( 'class' => 'alignleft' ) ); ?>

    <?php the_content(); ?><code></code><?php echo get_post_meta( $post->ID, 'ct_Website_text_b801', true ); ?>

    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', DR_TEXT_DOMAIN ), 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->

    This is the single-listing.php output: http://crescentridgehomeowners.com/listings/cliff-paulick-mcgraw-realtors/
    Why isn't it showing up?

  • fitoussi
    • The Incredible Code Injector

    did you copy the "default" folder from the directory plugin into "themes" folder? and activated the theme from there?
    if so, you might wanna check if you have "single-listing.php" in /wp-content/themes/default/. if the file exist in this folder then this is the file that you want to edit and not the one in wp-content/plugins/directory/themes/default/.

  • fitoussi
    • The Incredible Code Injector

    oh no, my apology. i didn't realize you do not use the directory's theme. I don't think that the plugin uses your single-listing.php file to display the posts.
    insert any kind of text under "the_content();" and see if it shows up in the page.

  • prestonkd
    • Flash Drive

    I have been messing with this for awhile. I think I may be close to getting it to work. Reading the discussion above helped me with a couple of things. Hoping maybe y'all can shed some light on what i hope is my last problem to get started.

    I have my custom fields created through CustomPress and embedded in my own theme. (see Screenshot)
    If I activate the supplied theme I can see the information which has been entered. (Screenshot)

    If I activate, my own theme, I can see the fields which I have named in the enbed codes - but NOT the information from the field. (screenshot)

    I'm not a coder and have just been feeling my way through this. I know that somehow I have not told it to get the information but am not sure what I have left out. It is obviously something that is in the included theme and NOT in my theme. Any thoughts would be appreciated. Thanks.

  • fitoussi
    • The Incredible Code Injector

    wow, that is really weird that it shows only in one theme but not in the other one. could be something in your theme that cause this to happen. i would try one more different theme just to see if it is your theme or not.

  • Kimberly
    • Champion of Loops

    I've been playing with this myself, sorry for missing this part of the question!

    You do need to embed the Custom Field code for it to show. I actually spoke with a support guru (Cheers Tim!) who made a fabulous suggestion: we should put this in as a feature request and find a way to use hooks to call the custom fields, or something similar. (sorry if I botched that Tim, it's late here! hehe)

    I can get the custom field to show in single.php but only at the top of the loop. If it's not first then it doesn't show at all.

    I've got a line in to someone a little more senior that is more familiar with the plugin, I'll see what he tells me. It would be nice to have some vanilla instructions for this. Part of the problem is that this plugin update is still so fresh that the documentation hasn't caught up yet.

    My apologies all the way around, I'll be looking for a fix as well! Thank You all for being such great Members!

    Best,

    Kimberly

  • prestonkd
    • Flash Drive

    I copied the single-listing.php file from the included theme and it worked. That doesn't make a lot of sense because the file didn't exist in my theme to begin with and the way I got it there in the first place was to copy from the other theme. Only thing that matters is that it worked. Thanks for the suggestion. I'm going to style my theme now and see if I can put all the pieces together and have it work. I appreciate it.

  • fitoussi
    • The Incredible Code Injector

    Great. And It is not included because it has to do with custom post type. Single.php that comes with every theme displays regular post. But When you create custom post type ( for example directory listing ) you need to add the file for its single posts. So you create file name single + the name of the custom post type ( single-listing.php).

  • Clifford P
    • The Bug Hunter

    (just rephrasing from the info above, thank you)

    So here is the solution:

    -copy /wp-content/plugins/directory/themes/default/single-listing.php to /wp-content/themes/name-of-your-theme-folder/single-listing.php
    -insert the CustomPress custom field embed code where you want (e.g. before or after Line 34: the_content():wink:

    The reason it works:

    -the Directory plugin outputs a CPT (Custom Post Type) called "listing"
    -the image at http://codex.wordpress.org/Template_Hierarchy ( http://codex.wordpress.org/images/1/18/Template_Hierarchy.png ) shows that single-$posttype.php has a higher hierarchy than single.php.

    Unresolved question:

    -What the heck is the plugins/directory/themes/default/single-listing.php file for anyways - in other words, how come it worked except when I was trying to add in my CustomPress fields?

    Thanks to everyone who participated and helped. I got what I needed just in time.

    Rep to @prestonkd (who had a typo: single_listing.php really meant single-listing.php, in case anyone got confused by that)

  • Clifford P
    • The Bug Hunter

    ditto @fitoussi

    (reposting this part...)
    Unresolved question:
    -What the heck is the plugins/directory/themes/default/single-listing.php file for anyways - in other words, how come it worked except when I was trying to add in my CustomPress fields?

  • fitoussi
    • The Incredible Code Injector

    The default folder inside the directory plugin holds the directory theme's files ( the theme that originally came with the plugin). In the betas version of the plugin we could only use the directory theme with the plugin so we use to activate it from its location( plugins/directory/themes/default/). Now, since we can use any theme the directory plugin uses the files that inside the theme you activated in /wp-content/themes/your-theme. The defaul folder is still there for whoever used it before and still want to use it just that now we can't activate it from its location and we have to move it to wp-content/themes. That is why Your changes in the single-listing.pho didn't show. the directory plugin used the single.php file that inside your theme and not the single-listing.php in the default folder . That is why my first suggestion was to create single-listing.php in your theme folder.

  • aecnu
    • WP Unicorn

    Greetings everyone,

    It appears that the current work around to this issue is the copying of the single-listing.php file from the included theme to the theme you are using and as prestonkd added Only thing that matters is that it worked in which I am in complete agreement.

    Therefore for the time being, this issue is resolved since we have a fix and at least until the new lead developers next version comes out - and we shall certainly see what the Directories plugin is being morphed into, as we know from previous tickets that it is to be completely unattached from the included theme so that it may work with almost any theme.

    Until then we thank you all for being WPMU Dev Members and for your comments and feedback.

    Cheers, Joe

  • Clifford P
    • The Bug Hunter

    After the newest version of Directory, I copied my same steps that I outlined above ( https://premium.wpmudev.org/forums/topic/creating-taxonomies-in-custompress-and-categories-in-directory#post-190884 ) and it no longer works. It just doesn't display any content - a blank page.

    Please provide instructions which file to copy from wp-content/plugins/directory/... into my-theme-folder/single-listing.php (or whatever are the new, correct instructions).

    Thank you.

  • aecnu
    • WP Unicorn

    Greetings,

    Just a heads up that the word in the wings is it is still another week or two away before we possibly go into Beta. Though this is unofficial word it is at the same time realistic.

    We thank everyone for their patience as Arnold truly hunkers down trying to get this plugin's coding together, synchronized with Custom Press, and a release worthy of us pursuing.

    Cheers, Joe

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.