Errors in 2.0.0
-
Updated to the latest version of the plugin. It broke my site, presumably because I was using the following function call: rgc_get_term_meta to build a category page with thumbnails.
has this been replaced with something else?
-
Hi Lozula,
Give me a sec to look into this for you.
Thanks very much. I looked through the code and it seems I probably should have been using gtaxi_get_taxonomy_image instead, but the 2.0.0 code appears to suggest this is deprecated.
Before I answer, can I see the exact function call you’re using please?
Sure. Ultimately I just want the image src for the term image for the current page I am on, which is a category page.
$term_image_id = rgc_get_term_meta($term, ‘term_thumbnail_id’);
OK. The reason I asked to see how you’re using it is so that I can see if you’re using it specifically for the term meta stored with this plugin, or if you’re using it for the general retrieval of term meta.
rgc_get_term_meta()is a wrapper for two things:get_term_meta()and then if that failed, to get the term meta that Genesis used to add in pre-2.3.0 (2016). This code still exists in the updated plugin (which you can see here). However this is a private method not accessible directly.The only reason this code still exists is for people running Genesis pre-2.3.0, when genesis slurped in all term meta whenever a term object was retrieved. This hasn’t been in Genesis since 2016 and I plan to phase out support for it at some point in the future.
So there are two options. First, I can add back that function for you. However I don’t suggest this.
The second solution is to use either
gtaxi_get_taxonomy_imageorget_term_metato get the image ID.Marking
gtaxi_get_taxonomy_imageas deprecated was a mistake that I’ll fix shortly.-
This reply was modified 6 years, 5 months ago by
theMikeD.
Thanks for the comprehensive and useful response π No need to add the function back in, I’ll use one of the other two options you suggest.
Try v2.0.1 pls, I fixed a small error.
Hi – ah, thank goodness. I was going slightly crazy trying to figure out why my code wasn’t working π Can confirm 2.0.1 works fine, now using gtaxi_get_taxonomy_image function.
Great! Thanks for your patience and for helping me improve the code! I’ll mark this as closed now but please open a new thread if you see any other weirdness π
Man, the update to v.2.0.1 broke my category listings with:
Fatal error: Uncaught Error: Call to undefined function rgc_get_term_meta() in…I’ve used the function directly with the following code:
if( function_exists(‘gtaxi_get_taxonomy_image’) ) {
$image_term_id = rgc_get_term_meta( $term, ‘term_thumbnail_id’ );
}Hi Ivan,
Sorry about that! I didn’t realize this function was being used directly. Please update your code to use
$image_term_id = gtaxi_get_taxonomy_image( array( 'term' => $term, 'format' => 'id' ) );instead of
$image_term_id = rgc_get_term_meta( $term, βterm_thumbnail_idβ );-
This reply was modified 6 years, 5 months ago by
theMikeD.
I had actually replaced it all with WordPress native, plugin independent:
$image_term_id = get_term_meta( $term->term_id, ‘term_thumbnail_id’, true );
Even better!
Thank you for a great plugin – it is a must-have functionality, I think.
-
This reply was modified 6 years, 5 months ago by
The topic ‘Errors in 2.0.0’ is closed to new replies.