WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Widget
[resolved] Dynamic link instead of javascipt link (28 posts)

  1. Saroj
    Member
    Posted 3 years ago #

    i love this plugin ,Problem with link structure.
    location.href = "{$url}/?" + this.name + "=" + this.options[this.selectedIndex].value;

    This link is not working for our custom permalink url structure.
    Using dynamic link will be good instead of this static link.

    http://wordpress.org/extend/plugins/taxonomy-widget/

  2. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    What is your permalink structure?

  3. Saroj
    Member
    Posted 3 years ago #

    /%category%/%postname%/

  4. Saroj
    Member
    Posted 3 years ago #

    Project Site Here i have changed the above link code , it gives ID something like this category/54 .I want to change that ID with category name like this one category/icons/

  5. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Please don't change the link code. It works fine for me with categories at least. Follow this link:

    http://vectshare.com/?cat=64

    it get's rewritten to:

    http://vectshare.com/category/fashion/

    What exactly is the problem?

    WordPress 3.0 and every previous version for that matter queries for categories by ID and other taxonomies by slug.

  6. Saroj
    Member
    Posted 3 years ago #

    thanks for supporting Michael

  7. Saroj
    Member
    Posted 3 years ago #

    changed to original link code,This time category taxonomy working well but other two custom taxonomies are nor rewriting the link structure

    for File format taxonomy with fileformat slug fileformat/ai/normally works well.
    same problem with License taxonomy with license slug
    after changing back to original link code it gives /?file_format=ai which is not rewriting to at-least /file_format/ai/

  8. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Please paste the code which you used to register your fileformat taxonomy.

  9. Saroj
    Member
    Posted 3 years ago #

    created with the help of this plugin

  10. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Would you be open to using custom code?

  11. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    How do you download it? I can't find the link :(

  12. Saroj
    Member
    Posted 3 years ago #

  13. Saroj
    Member
    Posted 3 years ago #

    changing the code again works but not flexible

    function get_query_var_name( $taxonomy ) {
    			if ( $taxonomy === 'file_format' )
    				return 'fileformat';
    			if ( $taxonomy === 'category' )
    				return '?cat=';
    			if ( $taxonomy === 'post_tag' )
    				return 'tag';
    			else
    				return $taxonomy;
    		}
    if ( this.options[this.selectedIndex].value != 0 && this.options[this.selectedIndex].value != -1 ) {
    				location.href = "{$url}/" + this.name + "/" + this.options[this.selectedIndex].value;
    			}
  14. Saroj
    Member
    Posted 3 years ago #

    problem solved after editing plug-in codes.
    Thanks Michael

  15. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Which plugin to you modify? Be sure to change the name to avoid conflicts with upgrades :)

  16. Saroj
    Member
    Posted 3 years ago #

    that's your widget taxonomy-widget.php

  17. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    IMO you made the wrong choice. My plugin has been tested on many site using a few of the other plugins that create taxonomies. This is honestly the first that I have heard about "More Taxonomies" and I have installed it and tested it out and it seems like the plugin does not automatically set the query_var property for the taxonomy objects that it creates. IMO this is most likely why you are experiencing these problems.

    Do what you wish, but if you choose to edit my plugin, please change the name. I will probably release an updated version when WordPress 3.1 rolls out and this will overwrite your changes if you accidentally upgrade it.

  18. Saroj
    Member
    Posted 3 years ago #

    OK,Changed the name of widget .

  19. Ani10
    Member
    Posted 3 years ago #

    I have the same problem. My permalink structure is: /%taxonomy%/%taxonomySlug%/

    and it works when I enter the URL in the browser, but the Taxonomy widget sets the link as:

    ?taxonomy=%taxonomy%&term=%taxonomySlug%

    Is there something I forgot to set in the plugin install? I really dont want to modify it...

  20. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Ani10,
    What method have you used to register your taxonomies with WordPress. Please post your code if available.

  21. Ani10
    Member
    Posted 3 years ago #

    Hi Michael, thanks for the quick response. I used the following code in my functions.php file

    add_action( 'init', 'crear_formatos', 0 );

    function crear_formatos()
    {
    $formatos = array(
    'name' => _x( 'formatos', 'taxonomy general name' ),
    'singular_name' => _x( 'formatos', 'taxonomy singular name' ),
    'search_items' => __( 'Buscar formatos' ),
    'popular_items' => __( 'Formatos populares' ),
    'all_items' => __( 'Todos los formatos' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Editar formato' ),
    'update_item' => __( 'Actualizar formato' ),
    'add_new_item' => __( 'Añadir nuevo formato' ),
    'new_item_name' => __( 'Nuevo nombre de formato' ),
    'separate_items_with_commas' => __( 'Separar formatos con comas' ),
    'add_or_remove_items' => __( 'Añadir o remover formatos' ),
    'choose_from_most_used' => __( 'Escoger de los formatos más usados' ),
    'menu_name' => __( 'formatos' ),
    );

    register_taxonomy('formatos','post',array(
    'hierarchical' => false,
    'labels' => $formatos,
    'show_ui' => true,
    'query_var' => true,

    'rewrite' => true,
    ));
    }

    The url with the permalink is working, but the link on each of the items generated by the widget is in other format =/

  22. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    First thing I would try is to comment out the following lines:

    'query_var' => true,
    'rewrite' => true,

    and then refresh your permalinks by visiting Settings -> Permalinks in the Administration Panels. If this does not work, please try the following arguments and then refresh your permalinks again:

    'query_var' => 'formatos',
    'rewrite' => array( 'slug' => 'formatos' ),

    BTW, WordPress does not really do this:

    /%taxonomy%/%taxonomySlug%/

    it does this:

    /%taxonomy%/%taxonomy-slug%/

    If nothing else works, please post a link to the site in question.

  23. Ani10
    Member
    Posted 3 years ago #

    The first setting made both urls invalid (the /%taxonomy%/%taxonomy-slug%/ and the one generated by your plugin). I have left the second setting. This is the site´s url:

    http://medea.pucp.edu.pe/endefensapucp/

    On the sidebar, compare the Taxonomy widget list, that is generated with your code, against the list in the Taxonomy regular widget, that was generated using the wp_tag_cloud();

  24. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Weird, somehow my plugin is setting a capitalized value for the query var:

    ?taxonomy=Formatos is not the same as ?taxonomy=formatos

    Is it possible that you have formatos capitalized somewhere? I don't think my plugin would do this for you.

    I've already rewritten a great deal of this plugin but am waiting to release it until 3.1 is stable.

  25. Ani10
    Member
    Posted 3 years ago #

    You were right. The taxonomy terms where registered with the first letter capitalized in the database due to an error when the taxonomy was first registered. I changed the database to lowercase and now the widget is working perfectly. Thanks for your attention! :) .

  26. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    No problem, Glad I could help!

  27. Ani10
    Member
    Posted 3 years ago #

    Just voted for your plugin, I almost forgot because of development rush. Works fine on wordpress 3.0.4 =D

  28. Michael Fields
    Themer
    Plugin Author

    Posted 3 years ago #

    Thanks! I do appreciate the ratings :) Glad to hear it works on 3.0.4.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic