Classifieds Widgets - Where are they?

I want a way to display categories, tags, recent ads in my sidebar but don't see any widgets for the Classifieds plugin. Are there any widgets available? If not, any suggestions on how to create these lists?

Thanks!

  • mccawphoto
    • The Incredible Code Injector

    So I found this code in the dashboard for Classifieds under Content Types -> Taxonomies:
    <?php echo get_the_term_list( $post->ID, 'classifieds_categories', 'Before: ', ', ', 'After' ); ?> Above it said "Returns an HTML string of taxonomy terms associated with a post and given taxonomy. Terms are linked to their respective term listing pages. Use it inside the Loop. "

    Here is the code I tried:
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php echo get_the_term_list( $post->ID, 'classifieds_categories', 'Before: ', ', ', 'After' ); ?>
    <?php endwhile; else: ?>
    <p>Sorry, no categories we're found.</p>
    <?php endif; ?>

    I tried this but nothing shows up. What is this code for if it doesn't show a list of the categories that I created inside the Classifieds plugin?

  • mccawphoto
    • The Incredible Code Injector

    Yes, I have created about a dozen categories. I actually got the above code to pull something in finally. The problem is that it is only listing the categories that have been used for the current ads. All of the categories that haven't been used to categorize any ads do not show up in the list. I want to list all categories that have been created.

    Thanks!

  • mccawphoto
    • The Incredible Code Injector

    I was able to get a list of all the categories I created using this code:

      <?php $taxonomies = get_object_taxonomies( 'classifieds', 'objects' ); ?>
      <?php foreach ( $taxonomies as $taxonomy_name => $taxonomy_object ): ?>
      <?php $terms = get_terms( $taxonomy_name, array( 'hide_empty' => 0 ) ); ?>
      <?php foreach ( $terms as $term ): ?>

    • "><?php echo $term->name; ?>
    • <?php endforeach; ?>
      <?php endforeach; ?>

    The problem is I haven't been able to have each category link to the page for ads in that category. Any help is appreciated.

    Thanks!

  • mccawphoto
    • The Incredible Code Injector

    Sorry I forgot to put the code in correctly. Here it is again.

    <ul>
                    <?php $taxonomies = get_object_taxonomies( 'classifieds', 'objects' ); ?>
    				<?php foreach ( $taxonomies as $taxonomy_name => $taxonomy_object ): ?>
                        <?php $terms = get_terms( $taxonomy_name, array( 'hide_empty' => 0 ) ); ?>
                        	<?php foreach ( $terms as $term ): ?>
                            	<li><a href="<?php the_permalink(); ?>"><?php echo $term->name; ?></a></li>
                            <?php endforeach; ?>
                    	<?php endforeach; ?>
                    </ul>
  • Andrey
    • The Incredible Code Injector

    Hi mccawphoto,

    please try this:

    <ul>
                    <?php $taxonomies = get_object_taxonomies( 'classifieds', 'objects' ); ?>
                    <?php foreach ( $taxonomies as $taxonomy_name => $taxonomy_object ): ?>
                        <?php $terms = get_terms( $taxonomy_name, array( 'hide_empty' => 0 ) ); ?>
                            <?php foreach ( $terms as $term ): ?>
                                <li><a href="<?php echo get_term_link( $term, $taxonomy_name ); ?>"><?php echo $term->name; ?></a></li>
                            <?php endforeach; ?>
                        <?php endforeach; ?>
                    </ul>
  • Kimberly
    • Champion of Loops

    mccawphoto,

    So glad you got your widget working :slight_smile:

    We are transitioning to a few new supporters for our plugins and have moved a couple people around, Andrey won't be able to follow up here so if you would like to go a bit further on your last question I would ask that you start a new thread so that we can flag the appropriate developer.

    I know it's a pain, but that's the only way we can ensure that your issue gets the attention it deserves instead of remaining hanging here. :slight_smile:

    (I'd like to close this one for housekeeping as you're a great member and we don't want you to get lost in our staffing shuffle!)

    I myself would have answered you, but alas you are much more adept at php than I so you're out of my league! Let me help get you the right advice. I'll ping whoever I need to once you open a new thread :slight_smile:
    Deal?

    Kimberly

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.