Forums

Taxonomy Terms List
display it on pages (20 posts)

  1. Niraj Chauhan
    Member
    Posted 1 year ago #

    hey hi Michael,
    i want to display custom taxonomies on pages,
    how can i do that,
    i have changed your plugin code, if you remember me i am the same guy who wanted the terms above the post, post

    now i want it to be displayed on pages
    i have three custom taxonomies, courses, location & duration
    i have created three pages with these names,
    now i just want that all my courses named custom taxonomy terms should be displayed on courses page, i selected all my courses terms from the side option in the edit page, but then also it is not coming
    how can they be displayed

  2. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    If I am understanding you correctly, you are seeking to display multiple posts having a term of one of these taxonomies on a page. If so, this is the incorrect way to go about doing this.

    WordPress 3.0 allows you to query for all posts associated with a term in a given taxonomy. /?location=taco-palace would display all posts located at the Taco Palace. The permalink alternative would look like this: /location/taco-palace/. You can also create a taxonomy.php file to tweak the display of taxonomy archives.

    Please let me know if I have understood you correctly.

  3. Niraj Chauhan
    Member
    Posted 1 year ago #

    hey i solved that, but i have another question,
    i have in total 3 custom taxonomies, with many terms in it
    for eg. i have custom taxonomy named as location, then i have MBA in USA as a term in it,
    in url when i type this
    http://www.domain.com/location/mba-in-usa
    then i get all the posts related to mba-in-usa,
    but now i want some description on mba-in-usa page, same for others, how can i do this,
    for this i had an idea, if in archive.php i write a condition
    if(page url=http://www.domain.com/location/mba-in-usa){
    echo description
    }

    but for this i am not getting a function to check the url, i tried clean_url but it seems not to work,
    can you give me some idea on this?

  4. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Try something like this:

    if ( is_tax() || is_category() || is_tag() ) {
    	$term = $wp_query->get_queried_object();
    	$taxonomy = get_taxonomy( $term->taxonomy );
    	$taxonomy_name = '';
    
    	if ( isset( isset( $taxonomy->singular ) ) {
    		$taxonomy_name = $taxonomy->singular;
    	}
    	else if ( $taxonomy->label ) {
    		$taxonomy_name = $taxonomy->label;
    	}
    
    	print '<h1>' . $taxonomy_name . '</h1>';
    
    	if ( isset( $term->term_id ) && isset( $term->taxonomy ) ) {
    		print term_description( $term->term_id, $term->taxonomy );
    	}
    }
  5. Niraj Chauhan
    Member
    Posted 1 year ago #

    in this where i have to write the description part????????

  6. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    It will use the description that you entered for the term in the administration panels

  7. Niraj Chauhan
    Member
    Posted 1 year ago #

    no but i want myself to write for every country, like mba-in-usa, mba-in-uk etc,
    is there anything in that,
    by that time i ll also try the above one

  8. Niraj Chauhan
    Member
    Posted 1 year ago #

    i am getting this error
    Parse error: syntax error, unexpected T_ISSET, expecting T_STRING or T_VARIABLE or '$' in /home/managem3/public_html/mbas/wp-content/themes/cityguide/archive.php on line 17

    i am putting this code in archive.php

  9. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    no but i want myself to write for every country, like mba-in-usa, mba-in-uk etc,
    is there anything in that,
    by that time i ll also try the above one

    Oh, so I guess I did misunderstand you. Try this plugin instead.

  10. Niraj Chauhan
    Member
    Posted 1 year ago #

    i think still you are not getting me,
    check this page

    http://mbas.in/location/mba-in-usa

    i want to type a custom message or description on the top of this page,
    and there are many pages
    for eg
    http://mbas.in/location/mba-in-uk
    http://mbas.in/location/mba-in-india
    http://mbas.in/location/mba-in-africa
    http://mbas.in/location/mba-in-china
    etc
    for that i have to write some if else condition, where if the page url is usa, then display this description else if the url of page is asia then display this description

    is some code like this???

  11. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    If you are set on using page templates for this, then you make a custom page template and code a conditional:

    if ( is_page( 'your-page-slug' ) )
       print 'My message';
    else if ( is_page( 'a-different-page' ) )
       print 'A different message';

    repeat as much as necessary...

    Multiple taxonomy queries are a part of WordPress 3.1 and are working rather well in the Beta version.

    3 Bookmarks about javascript:
    http://wordpress.mfields.org?topics=javascript

    2 Bookmarks from WP Hardcore:
    http://wordpress.mfields.org?source=wp-hardcore

    1 Bookmark about javascript from WP Hardcore:
    http://wordpress.mfields.org/?topics=javascript&source=wp-hardcore

    This is probably the best way to do this IMO... but 3.1 is still in Beta at the moment....

  12. Niraj Chauhan
    Member
    Posted 1 year ago #

    hey i googled it to find the slug of the page,
    according to this page info the slug of this url
    http://mbas.in/location/mba-in-usa
    is 'mba-in-usa'
    but still it is not working,
    the messages or the description is still not coming
    this code i tried,

    <?php
    		if ( is_page( 'mba-in-usa' ) )
    			print 'My message';
    		else if ( is_page( 'mba-in-uk' ) )
    			print 'A different message';
    		?>

    but still it is not working

  13. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Put the following code in archive.php where you would like the description to be displayed:

    if ( is_tax( 'location' ) ) {
    	print term_description();
    }

    Edit each term of the location taxonomy adding a description for each one.

    1. mba-in-uk
    2. mba-in-india
    3. mba-in-africa
    4. mba-in-china

    You should now see the description displayed in your archive template.

  14. Niraj Chauhan
    Member
    Posted 1 year ago #

    hey thanks this worked,
    one last question is it possible to put the terms of taxonomy into drop-down box?
    i mean to say
    location:drop-down box(all terms of location)

    and when a person selects it, it directs to the corresponding page,

  15. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

  16. Niraj Chauhan
    Member
    Posted 1 year ago #

    i tried this code,

    <?php
    wp_dropdown_categories( array(
    'taxonomy' => 'location'
    ) );
    ?>

    and the it is working but i want a button next to the dropdown list, that when a person hits that button, it redirects to the corresponding page,
    or when the user selects the item from drop-down box, it immediately redirects it,
    is this possible?

  17. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

  18. Niraj Chauhan
    Member
    Posted 1 year ago #

    but it is displaying in widget area,
    i want it on my home page

  19. Michael Fields
    Theme Wrangler
    Posted 1 year ago #

    Can you add a widget area to your homepage?

  20. Niraj Chauhan
    Member
    Posted 1 year ago #

    i didnt get you,
    your plugin is good, and perfect for me,
    but i want to display on my homepage, neither on widget area
    is this possible to make your plugin display on homepage?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic