Haldaug
Forum Replies Created
-
Forum: Plugins
In reply to: [Yoast SEO] Gutenberg + Yoast SEO ConflictCould this be the same bug as this?
I’ve created a new GitHub issue: https://github.com/Yoast/wordpress-seo/issues/10850
Forum: Plugins
In reply to: [Co-Authors Plus] Sortable authors Not Working any moreA fix is available in the thread mentioned by @hooperkat above.
Forum: Plugins
In reply to: [Co-Authors Plus] Order of authors not retainedActually, scratch this hack and substitute it for this much simpler hack courtesy of Miles Blackwood Robinson over at this plugin’s Github repository: https://github.com/Automattic/Co-Authors-Plus/issues/390
The fix is as follows. Simply substitute line 17 in the file template-tags.php from:
$coauthor_terms = get_the_terms( $post_id, $coauthors_plus->coauthor_taxonomy );
to:
$coauthor_terms = wp_get_object_terms( $post_id, $coauthors_plus->coauthor_taxonomy, array( 'orderby' => 'term_order', 'order' => 'ASC' ) );
Forum: Plugins
In reply to: [Co-Authors Plus] Order of authors not retainedThanks for the hack, Alan!
It didn’t work for me, but after a few modifications I got it to work. Here is my modified version:
if ( is_array( $coauthor_terms ) && ! empty( $coauthor_terms ) ) { // Collect all author term IDs $term_ids = array_map(function($el){ return $el->term_id; }, $coauthor_terms); // Collect all taxonomy term IDs per author $sql_get_term_taxonomy_ids = sprintf( "SELECT term_taxonomy_id FROM %s WHERE term_id IN (%s) ", $wpdb->term_taxonomy, join(', ', $term_ids) ); $term_taxonomy_ids = $wpdb->get_results($sql_get_term_taxonomy_ids); $term_tax_ids = array_map(function($el){ return $el->term_taxonomy_id; }, $term_taxonomy_ids); // Get order of term taxonomy IDs for this post $sql_get_author_order = sprintf( "SELECT term_taxonomy_id, term_order FROM %s WHERE object_id = %d AND term_taxonomy_id IN (%s) ORDER BY term_order ASC", $wpdb->term_relationships, $post_id, join(', ', $term_tax_ids) ); // Organize order by term ID $author_order_data = $wpdb->get_results($sql_get_author_order); if(!empty($author_order_data)) { $author_order_data_ids = []; foreach($author_order_data as $order_data) { $author_order_data_ids[$order_data->term_taxonomy_id] = $order_data->term_order; } foreach($coauthor_terms as &$coauthor_term) { $coauthor_term->order = $author_order_data_ids[$coauthor_term->term_taxonomy_id]; } } // Sort authors by order usort($coauthor_terms, function($a, $b){ return ((int) $a->order > (int) $b->order) ? 1 : -1; }); foreach ( $coauthor_terms as $coauthor ) { // ..
As you can see, I iterated over the term_taxonomy_id’s instead of term_id.
Forum: Plugins
In reply to: [Knight Lab Timeline] Unable to change languageThat worked perfectly. Thanks for the fast response and an excellent plugin!