Code Monkey home page Code Monkey logo

wp-term-images's People

Contributors

jjj avatar mayukojpn avatar stevegrunwell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wp-term-images's Issues

Quick Edit Replaces Image Meta Value

To reproduce:

  • Add a new term w/ an image.
  • Quick edit and save the term
  • Check meta value for term (you can inspect the admin-ajax.php network request
  • ???
  • Profit

The issue stems from /assets/js/term-image.js on Line 113. The image URL is being inserted instead of the image's attachment ID.

It looks like removing that line fixes it. Since the image is already set, the value doesn't need to be overridden every time someone clicks the quick edit button. I could have overlooked something though.

Cheers ๐ŸŽ‰

Get Term Image code

Hi John,

I'm using this plugin with WordPress 4.4-beta1. I've used the code snippet from the readme and found it just returns the meta_value for the term_id. Seeing as the code is echoing the img element I imagine it should return the image URL. I found that the below worked for my purposes:

$image = get_term_meta( 452, 'image', true );
    if ( ! empty( $image ) ) {
        echo '<img src="' . esc_url( wp_get_attachment_image_url( $image, 'full' ) ) . '" />';
}

I'm very much a PHP n00b, so if this isn't relevant please ignore this issue.

Cheers,

Joel

conflict with the WooCommerce 'product_cat' taxonomy on the edit-tags.php screen

I'm evaluating using this plugin on a WooCommerce site I'm building.

Woo already has built-in support for adding images to it's product_cat taxonomy. And I want to add images to Woo's product_tag taxonomy...and that works fine.

However, there's a conflict with WP_Term_Meta_UI::term_clauses() and the way Woo alters what is returned by get_terms().

Woo provides a drag-and-drop UI on the edit screen for the product_cat taxonomy that allows a user to specify a sort order for the terms in that tax on the front end. It stores that order order as term meta. By default, it orders to terms in the terms list table by that sort order...as such it adds 'orderby' => 'meta_value_num' (thru some filter, I forget which at the moment).

Unfortunately, when WP_Term_Meta_UI::term_clauses() sees 'orderby' => 'meta_value_num' it joins to the term meta table and alters the where clause such that only terms with the image meta key are return. This results in 0 terms being found, even tho the list table realizes there are terms in the taxonomy as evidenced by the highlighted numbers in this screenshot.

no-product-cats-found

[Note: the Image column in that screenshot is Woo's built-in column, and not the one added by this plugin. I have hooked into wp_term_image_get_taxonomies and restricted the taxonomies this plugin adds the Image column on to Woo's product_tag tax.]

As a workaround I tried to unhook WP_Term_Meta_UI::term_clauses() and WP_Term_Meta_UI::get_terms_orderby() from terms_clauses and get_terms_orderby respectively since I don't want the Image column to be sortable anyway. I'm hooking into manage_edit-product_tag_sortable_columns to remove the Image column this plugin adds from the sortable columns (to match the fact that Woo's built-in Image column for the product_cat taxonomy isn't sortable). However, since there is no global variable for that object I can't do that.

I bet Woo isn't the only thing that will conflict with allowing 'orderby' => 'meta_value_num' to cause the join/where modifications that WP_Term_Meta_UI::term_clauses() does.

Knowing you, I'm sure there's a good reason for having meta_value_num in $allowed_keys even tho this plugin doesn't ever key that as an orderby, but for the life of me I can't figure out why :-) This plugin seems to work just fine if I remove meta_value_num from $allowed_keys.

Nice plugin...

...I saw you need some front-end help. Hit me up, maybe I can help. I've been working on some plugins for clients and there would be overlap.

Image preview size is tiny

Hi,

Love your new suite of Term Meta plugins.

Was just trying out this term image plugin.
Works well and is nice and clean, but I found the preview image in the admin list view feels teeny tiny at 25 x 25 px - it doesn't feel big enough to be a preview, just lets you know there is an image assigned.

Any reason you don't use a larger preview like the Media list view which is 60 x 60 px?
(I could obvious hook in and override the styling, just wondering if the default is too small)

As a sidenote, I took over management of the Taxonomy Images plugin which used to be managed by Michael Fields but needed some updating for recent versions of WordPress - was still using old media modal. I've not yet moved it over to use term meta but I'd like to make that transition including migration of old data etc. If I were to do that, what are your thoughts on storing the image ID using the same meta key as your plugin so that the 2 plugins could be interchangeable - good idea or bad idea? Certainly would't want to do that without your blessing ๐Ÿ˜‰

Ben

Choose Image button not working on edit term screen.

When creating a new term (edit-tags.php), the "Choose Image" button works and the Media Modal displays.

When editing a single term (term.php), the "Choose Image" button does not launch the Media Modal.

WP: v4.5.3
WP Term Images: 0.3.0

WP_Term_Meta_UI->save_meta called when updating meta programatically, deletes meta.

If wp_update_term() is called, to update a term outside of the admin screen, the save_meta function is run from the edit_term action, causing the image meta to be deleted.

There is a line that says:
// Bail if not updating meta_key
But it doesn't actually bail, proceeding to call $this->set_meta, which then calls delete_term_meta().

Image URL in rest api instead of ID

Hello, i was inquiring how to get image url i have saw the pull request that add
register_meta( 'term', $this->meta_key, array( 'sanitize_callback' => array($this, 'sanitize_callback'), 'auth_callback' => array($this, 'auth_callback'), 'show_in_rest' => apply_filters("wp_term_image_show_in_rest", true), 'single' => true, ) );
to the class-wp-term-meta-ui.php but all i get is the ID and i have searched for that filter "wp_term_image_show_in_rest" but i couldn't get it, any help??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.