bmontgomery
Forum Replies Created
-
Forum: Plugins
In reply to: [WPAdverts - Classifieds Plugin] Paid subscription to publish adsThanks for your answer
Forum: Themes and Templates
In reply to: WordPress creditsCould someone help me with this ?
I really don’t understand.
What could be the hook to use to get rid of this message ?Forum: Themes and Templates
In reply to: WordPress creditsNo, I wrote it from scratch… that’s why I don’t understand where it comes from !
Forum: Hacks
In reply to: How to sort the results of custom WP_Query by category nameI was unable to make changes to the query, it’s very complicated…
I thought it was ok, I thought I was able to order by category, but when I had a closer look, it was ordered by another taxonomy, and I don’t know why.Here’s what I did:
add_filter('posts_clauses', 'posts_clauses_orderby_category', 10, 2); function posts_clauses_orderby_category( $clauses, $wp_query ) { global $wpdb; if (isset($wp_query->query['orderby']) && ($wp_query->query['orderby'] == 'category')) { $clauses['join'] .= " INNER JOIN {$wpdb->term_taxonomy} AS wptt ON wptt.term_taxonomy_id = tt1.term_taxonomy_id INNER JOIN {$wpdb->terms} AS wpt ON wpt.term_id = wptt.term_id "; $clauses['orderby'] = "wpt.name "; $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get('order') ) ) ? 'ASC' : 'DESC'; } return $clauses; }
If I can’t find any solution, I’ll have to rewrite the code for the plugin, but I’m not very interested in doing it, as the plugin is working fine.
If I rewrite it, there are chances to get some bugs.I think I should be able to do it. I’m going to go out for a walk and try when I get back. On your side, did you have a chance to have a look at it ?
Forum: Hacks
In reply to: How to sort the results of custom WP_Query by category nameHere’s what I added with WP_Query call:
$custom_query = new WP_Query($args); echo "<p>Last SQL-Query: {$custom_query->request}</p>";
So it gives me the SQL query. Now I’m going to have a look when I get some time, and I’ll try to do something smaller – because the actual query is quite big and complicated. I’m going to try and do a smaller query.
I’ll get back to you as soon as I can.
Thanks
Forum: Hacks
In reply to: How to sort the results of custom WP_Query by category nameActually I alredy tried to make changes to the query but it’s not working.
At the time, I was trying to sort by a taxonomy called “destination”.
Here’s the code that I added to my functions.php file:add_filter('posts_clauses', 'posts_clauses_orderby_destination', 10, 2); function posts_clauses_orderby_destination( $clauses, $wp_query ) { global $wpdb; //array of sortable taxonomies $taxonomies = array('destination'); if (isset($wp_query->query['orderby']) && in_array($wp_query->query['orderby'], $taxonomies)) { $clauses['join'] .= " LEFT OUTER JOIN {$wpdb->term_relationships} AS rel2 ON {$wpdb->posts}.ID = rel2.object_id LEFT OUTER JOIN {$wpdb->term_taxonomy} AS tax2 ON rel2.term_taxonomy_id = tax2.term_taxonomy_id LEFT OUTER JOIN {$wpdb->terms} USING (term_id) "; $clauses['where'] .= " AND (taxonomy = '{$wp_query->query['orderby']}' OR taxonomy IS NULL)"; $clauses['groupby'] = "rel2.object_id"; $clauses['orderby'] = "GROUP_CONCAT({$wpdb->terms}.name ORDER BY name ASC) "; $clauses['orderby'] .= ( 'ASC' == strtoupper( $wp_query->get('order') ) ) ? 'ASC' : 'DESC'; } return $clauses; }
Now I had to make some changes to the code, and I’d like to sort by category name, so I guess the code would be more or less the same (as the category is a taxonomy), but it doesn’t seem to be working either…
Do you see what could be the problem of my code?
I must admit that the query is quite complicated…Thanks for your help.
Forum: Hacks
In reply to: How to sort the results of custom WP_Query by category nameOK… Thanks for your answers.
Actually, I could use both methods, but I’ll have pagination issues.Because I run the query, and then I only display the page (a certain number of results per page).
If I start but retrieving the categories, then I’ll have to fetch all the results for all the catogries, and only after, display the page.
Or if I use usort(), I first have to retrieve all the results from wp_query, and do the same thing (only display the page taht the user wants to see).
Using a CF to store the category could be possible, but I’ll have to edit more than 400 posts…
What option would you choose?
Forum: Hacks
In reply to: How to sort the results of custom WP_Query by category nameno, my plugin only deals with taxonomies.
I’d rather sort by taxonomy but I saw that it’s very coplicated.
I tought it would be easier to sort by category name…Forum: Plugins
In reply to: Search functionanyone?
Forum: Plugins
In reply to: [Gravity Forms Directory] Question about your pluginHello,
I really do need to know if this plugin can do all the things that I described above.
Is there somebody who could answer me?
It’s pretty urgent…Thanks a lot.
Forum: Plugins
In reply to: [Theme My Login] Admin redirect not workingto the admin dashboard. That’s why I first chose “Default” (Check this option to send the user to their WordPress Dashboard/Profile) for the admin redirection.
As it was not working, I then chose “custom” and wrote: https://www.mysiteurl.com/wp-admin
but it’s still not working…
Forum: Plugins
In reply to: Tracking sales in woocommerceI saw that there’s a plugin to track sales, but in my case I don’t have the amount in the tracking link, so I have to pass it.
That’s why I decided to use a custom code.What I need to know if it’s ok or not.
Anyone ?
Forum: Themes and Templates
In reply to: how to add a new translationWhat I’d like to know, if how can I do to translate a widget that’s in my theme.
And how can I do to translate a new widget that I added with a plugin: is it possible to add the new strings in my existing po file? Or do I have to create another po file ?
Please help me.Forum: Themes and Templates
In reply to: how to add a new translationHello,
Is there anyone who could help me ?
Thanks
Forum: Plugins
In reply to: How to display all the records except some of themI found the answer.
The query is:
SELECT DISTINCT ID, user_login, user_nicename FROM $wpdb->users, $wpdb->usermeta WHERE ID = user_id AND ID NOT IN (SELECT user_id from $wpdb->usermeta WHERE (meta_key=’active’ AND meta_value=’1′))