dina_fire
Forum Replies Created
-
Forum: Plugins
In reply to: [Polylang] Different domains per language results in DNS lookup errorI’ve been using Chrome for testing this whole time, and when I deactivated Polylang and STILL got redirected to the SAME url, I thought “Crap, what if my browser cached the redirect??”
Sure enough, Firefox has no such problem. frenchdomain.ca points to the expected content with Polylang activated and deactivated.
Not totally sure how that redirect got cached in the first place. But my issue is resolved, so I’ll call this closed. Thanks for your help, Chouby.
Forum: Plugins
In reply to: [Polylang] Different domains per language results in DNS lookup errorForum: Plugins
In reply to: [Polylang] Different domains per language results in DNS lookup errorSo I managed to get rid of the trailing /en/ from the redirected url by changing the Polylang settings to “The language is set from content” and then back to “The language is set from different domains”, but frenchdomain.ca still redirects to englishdomain.ca!
I hope my inane ramblings at myself here are at least entertaining to others, if not helpful to people with similar problems.
Forum: Plugins
In reply to: [Polylang] Different domains per language results in DNS lookup errorOkay haha I was right, I just needed to flush my permalinks!
But now I’m having a new problem. The French domain works as expected, directing the browser to the correct content, switching back and forth with no problems, EXCEPT the home page! frenchdomain.ca redirects to englishdomain.ca/en/ for no reason that I can figure out, not to mention that this 404s because the /en/ or /fr/ url construction is obviously disabled.
Any idea why it’s doing this?
Forum: Fixing WordPress
In reply to: True alphabetization for post titlesOkay, I did figure something out. I ended up using $wp_query after all, like Tara suggested.
$args = array( 'post_type' => 'comic', 'posts_per_page' => -1, 'orderby'=> 'title', 'order' => 'ASC'); $comics = new WP_Query($args); if($comics->have_posts()){ ?> <ul> <?php while($comics->have_posts()){ $comics->the_post(); $review= get_page_by_title(get_the_title(),'OBJECT','post'); echo '<li>'; echo get_the_content(); if($review && $review->post_status == 'publish'){ echo '—<a class="review-link" href="'.get_permalink($review).'">Read my review</a>'; } echo '</li>'; } ?> </ul> <?php }
and then added the following filter to my functions file:
add_filter('posts_orderby', 'edit_posts_orderby'); function edit_posts_orderby($orderby_statement) { global $wp_query; if(is_page('what-i-read')) $orderby_statement = "TRIM(LEADING 'a ' FROM TRIM(LEADING 'an ' FROM TRIM(LEADING 'the ' FROM LOWER(wp_posts.post_title)))) ASC"; return $orderby_statement; }
Works like a charm, hope this helps anyone else who needs it.
Forum: Fixing WordPress
In reply to: True alphabetization for post titlesI’ve read that Codex entry top to bottom – no help. No mention of how to ignore articles. :/
Forum: Fixing WordPress
In reply to: True alphabetization for post titlesBecause of where I’m getting the posts, using $wp_query directly is something I’d rather not do. Also, this code appears to do the same thing as get_posts(orderby=>title) (to paraphrase the actual code). Is there a difference between alphabetizing in the query directly and alphabetizing using get_posts()?
Forum: Plugins
In reply to: [Polylang] Programmatically set language?Perfect, thank you.
Forum: Plugins
In reply to: [Polylang] Comments don't appear on posts that don't have a language setI found the culprit in the Polylang code. In filters.php theres a callback hooked to comments_clauses that alters the query so it only shows comments on posts that match the current language. According to the comments this is for things like the Recent Comments widget, so it only shows comments in the proper language. That makes sense if you’re trying to aggregate site-wide comments, but the filter is also running on post singles with no language set, which causes problems.
I decided to just unhook that filter altogether, since I’m not using the Recent Comments widget or anything similar on this site. However, this proved to be quite difficult since the plugin sets the hook with an object that I can’t seem to access outside the class.
Other people who had this or similar problems suggested using remove_filter like so:
function polylang_remove_comments_filter() { global $wp_filter; global $polylang; remove_filter('comments_clauses', array(&$polylang, 'comments_clauses')); } add_action('wp','polylang_remove_comments_filter');
This did not work for me, although it’s possible it worked for an older version of Polylang. The function remove_filter requires that the callback parameter be passed EXACTLY as it was originally passed to add_filter, which means if you don’t have access to the original instance of the object used, you can’t.
Well, you almost can’t. I did manage to dig up a cleverer coder than I explaining how to remove a filter that has been set with an anonymous object:
add_action('wp','remove_polylang_comment_filter'); function remove_polylang_comment_filter() { remove_anonymous_object_filter( 'comments_clauses', 'PLL_Filters', 'comments_clauses' ); } function remove_anonymous_object_filter( $tag, $class, $method ) { $filters = $GLOBALS['wp_filter'][ $tag ]; if ( empty ( $filters ) ) return; foreach ( $filters as $priority => $filter ) { foreach ( $filter as $identifier => $function ) { if ( is_array( $function) and is_a( $function['function'][0], $class ) and $method === $function['function'][1] ) { remove_filter( $tag, array ( $function['function'][0], $method ), $priority ); } } } }
This did work for me, and I hope it helps anyone else who runs into this problem, but as you can see it’s a much more complicated and processor-heavy solution, so I hope that future versions of Polylang address this issue – both the overzealous filter and the difficulty involved in disabling it.
Forum: Plugins
In reply to: [Polylang] Programmatically set language?After poking around in the database of my site, I figured out how Polylang stores its language information – as taxonomy terms, in the wp_terms table. It’s not a perfect solution for a number of reasons, but you could just check what the ID of your desired language is and use wp_set_object_terms() to add the term to your posts.
Ideally you (and I) would use a function native to Polylang to avoid hunting in the database for the term ID, not to mention to avoid having to implement the fix differently on different websites, but I unfortunately don’t know of such a function.
Hope this helps, as far as it can.
Forum: Plugins
In reply to: [Knews Multilingual Newsletters] Automatically unsubscribe deleted users?Thanks, that did work for me.
For others who may have this problem, I did this:
$wpdb->update( 'wp_knewsusers', array( 'state' => 3 ), array( 'email' => $person->user_email ) );
Forum: Plugins
In reply to: [Post Ratings] text-indent for star screenreader text not sufficientThe font size trick won’t work for the same reason that font size styling is unreliable: people’s browser setting override your css. If someone with vision problems sets their browser to display text at 16 or 20 pts
so they can read it, your screenreader text will be clearly visible. Also, I’m not convinced that 1px-sized text will be completely invisible. Using text-indent or clip is more reliable by far.Forum: Plugins
In reply to: [Knews Multilingual Newsletters] SMTP password not saving properlyThanks for the reply, but I can’t reproduce the problem now either! It just randomly stopped happening. I’m thinking maybe it was caused by something other than your plugin. I’ll update you if it rears its head again, though.