WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
[resolved] taxonomy should get a dropdown (18 posts)

  1. vincentlopy
    Member
    Posted 3 years ago #

    Hello Scribu,
    very good plugin!
    For my project, taxonomy should get a dropdown and not autosuggest field. Values of this taxonomy should be taken directly from the database.
    I have written, for example, 4 values ​​for the taxonomy. In practice, taxonomy dropdown should be populated dynamically.

  2. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I agree that it would be useful in some cases to have a dropdown instead of an autosuggest, but not in all cases.

    Therefore, there needs to be a way for the user to choose which taxonomy should get a dropdown and which should get an autosuggest field.

  3. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    The development version (2.0-alpha) of the plugin now uses a dropdown to edit terms in hierarchical taxonomies.

    If your taxonomy is not hierarchical, you can force the dropdown with a few lines of code:

    function fee_force_dropdown( $data ) {
      if ( isset( $data['taxonomy'] ) && 'taxonomy_name' == $data['taxonomy'] )
        $data['type'] = 'termselect';
    
      return $data;
    }
    add_filter( 'front_end_editor_wrap', 'fee_force_dropdown' );

    Obviously, replace 'taxonomy_name' with your taxonomy.

  4. vincentlopy
    Member
    Posted 3 years ago #

    Hello Scribu,
    great, code working very fine. Thanks! Only a problem, custom taxonomy is popolated only from values that have associated post. In others words, values that are not actives (without post/posts) are not presents when I edit taxonomy. Is it possible populate with all values?

  5. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Done. You should see it if you re-download the development version in about 15 minutes.

  6. 2046
    Member
    Posted 3 years ago #

    Doesn't work

    Warning: require(..../wp-content/plugins/front-end-editor/scb/load.php) [function.require]: failed to open stream: No such file or directory in ,,,,/wp-content/plugins/front-end-editor/front-end-editor.php on line 30

    Fatal error: require() [function.require]: Failed opening required '..../wp-content/plugins/front-end-editor/scb/load.php' (include_path='.:/usr/share/php:/usr/share/pear') in ..../wp-content/plugins/front-end-editor/front-end-editor.php on line 30

    version 1.9.3

    btw if you manage to make taxonomy terms editable as drop-down, then there are no categories needed ;)

    thanks 2046

  7. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Make sure you uploaded all the files.

    Also, you won't see the dropdowns in version 1.9.3, but in 2.0-alpha, linked before.

  8. 2046
    Member
    Posted 3 years ago #

    that's awesome :)

  9. vincentlopy
    Member
    Posted 3 years ago #

    great, thanks Scribu, now its very good.
    Only a strange issues in page: check this screenshot, with ufficial version of this plugin, only elements are on same row, now in 3 different rows.
    Check also this screenshot, text (word "appartamento") has issues about align.

  10. vincentlopy
    Member
    Posted 3 years ago #

    With version 1.9.3 there is this <span data-type="textarea", in version 2.0-alpha, <div data-type="textarea".

  11. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Yes, it's a div, but it has the fee-inline class, which sets display:inline, so it should look the same.

  12. vincentlopy
    Member
    Posted 3 years ago #

    its not look same. this is class attribute: screenshot. Which file contains setting about div or span?

  13. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    I've reverted the dev version (2.0-alpha1) to spans for inline elements.

    If you're still having problems, please paste the entire span or div tag:

    <span ...all the attributes... >

  14. vincentlopy
    Member
    Posted 3 years ago #

    Im still having problems, this is code
    <div data-type="textarea" data-post_id="264" data-key="richiesta_prezzo" data-values="[]" data-i="0" class="fee-field fee-filter-post_meta">800000</div>

  15. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    Ah, I see. Version 1.9.3 actually had incorrect behaviour.

    The thinking goes like this: If you need a textarea to edit that element, it's probably a block element, so it should go in a div.

    Replace:

    <?php editable_post_meta( get_the_ID(), 'your_key', 'textarea' ); ?>

    with

    <?php editable_post_meta( get_the_ID(), 'your_key', 'input' ); ?>

    and it should look alright.

  16. vincentlopy
    Member
    Posted 3 years ago #

    I have done, but the issue is caused for div element:
    <div data-type="input" data-post_id="264" data-key="spese_condominiali_annue" data-values="[]" data-i="0" class="fee-field fee-filter-post_meta fee-inline" style="display: block; ">1100</div>
    To resolve, should be:
    <span data-type="input" data-post_id="264" data-key="spese_condominiali_annue" data-values="[]" data-i="0" class="fee-field fee-filter-post_meta fee-inline" style="display: block; ">1100</div>
    Is there a way to replace <div... with <span... ?

  17. vincentlopy
    Member
    Posted 3 years ago #

    resolved Scribu. I have changed in base.php

    if ( $inline || in_array( $data['type'], array( 'input', 'image' ) ) )
    			 $wrap_tag = 'span';
    		else
    		     $wrap_tag = 'div';

    to

    if ( $inline || in_array( $data['type'], array( 'input', 'image' ) ) )
    			 $wrap_tag = 'span';
    		else
    		     $wrap_tag = 'span';

    So only elements is in span attribute. (like in version 1.93.) Its really better so, because there are not problems with alignment in tables.

  18. scribu
    Member
    Plugin Author

    Posted 3 years ago #

    You're right. If I remember correctly, the reason for sometimes using a div was for W3C compliance, which didn't really fix anything.

    The latest dev version always uses a span.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic