vhf
Forum Replies Created
-
Forum: Plugins
In reply to: [Event Organiser] event organiser and wpmlHi,
Did you find a solution to your problem ?
Well, if the original unmodified version of this plugin doesn’t work for you, I can’t help you.
It seems that the problem doesn’t come from the plugin but from your webserver/php configuration.
16777216B is way less than 256MB, if I were you I would check my configuration again.
No, it doesn’t work with qTranslate Slug.
But as a happy user, I really wanted to use it with qTranslate Slug, just like you.
I managed to make them work together, but my hack is really ugly and I don’t expect it to work on any qTranslate Slug install because I kind of hard-coded my qTranslate settings. However, it should work for everybody using foo.bar/lang/some/permalink/structure/. If you use ?lang=lang instead, you’ll have to hack further.
In sitemap-qtranslate.php, replace :
// Add an extra permalink url for every non-default qTranslate language foreach ($languages as $language) { if ($qt["hide_default_language"] == 1 && $qt["default_language"] == $language) { $sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority); } else { $sitemap->AddUrl(qtrans_convertURL($permalink, $language, true), $modified_time, $change_freq, $priority); } }by :
global $q_config; $oslug = new QtranslateSlug(); $oslug->init(); $a = $permalink; foreach($q_config['enabled_languages'] as $language) { if ($qt["hide_default_language"] == 1 && $qt["default_language"] == $language) { $sitemap->AddUrl($permalink, $modified_time, $change_freq, $priority); } else { $a = substr($a, 0, strrpos(substr($a, 0, -1), '/')).'/'; if(!in_array($a, array('http://', 'http:/'))) { $slug = get_post_meta( url_to_postid($permalink), $oslug->get_meta_key($language), true); $turl = str_replace(home_url(), home_url().'/'.$language, $a.$slug.'/'); $turl = preg_replace('#([^:])//#', '$1/', $turl); $sitemap->AddUrl($turl, $modified_time, $change_freq, $priority); } } }Dear developpers of this plugin, thanks for your hard work ! Please integrate some qTranslate Slug support in the next version !
Should you need a starting point, have a look at my dirty code. 🙂Forum: Hacks
In reply to: Get post from image URLCould a mod move this to WP-Advanced please ?
Thanks
Forum: Hacks
In reply to: Creating a Comment History?Yep, we could try this.
But to set this $per_page argument, we need to know how many comments per page you have. 😉[edit]
Anyway :
replace : get_comment_link($comment->comment_ID)
by : get_comment_link($comment->comment_ID, array(‘per_page’ => 123))
if 123 comments per page.Forum: Hacks
In reply to: Creating a Comment History?Could be a problem caused by WP-Paginate, but since I don’t know this plugin and don’t want to test it, I can’t help you any further, sorry.
Forum: Hacks
In reply to: Creating a Comment History?Right, I misunderstood the whole idea. I thought your where looping (i.e. foreach, here) through all comments for a specific post, I forgot it was all comments from an author.
Anyway, after a short research, I found an easier way to do this :
get_comment_link()<?php if( is_user_logged_in() ) : global $current_user; get_currentuserinfo(); $querystr = " SELECT comment_ID, comment_post_ID, post_title, comment_content FROM $wpdb->comments, $wpdb->posts WHERE user_id = $current_user->ID AND comment_post_id = ID AND comment_approved = 1 ORDER BY comment_ID DESC "; $comments_array = $wpdb->get_results($querystr, OBJECT); if( $comments_array ): ?> <h2>Your Recent Posts</h2> <ul> <?php foreach ( $comments_array as $comment ): setup_postdata( $comment ); echo "<li><a href='".get_comment_link($comment->comment_ID)."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>"; endforeach; ?> </ul><?php endif; endif; ?>Forum: Hacks
In reply to: Creating a Comment History?Something like this should work :
<?php if( is_user_logged_in() ) : global $current_user; get_currentuserinfo(); $querystr = " SELECT comment_ID, comment_post_ID, post_title, comment_content FROM $wpdb->comments, $wpdb->posts WHERE user_id = $current_user->ID AND comment_post_id = ID AND comment_approved = 1 ORDER BY comment_ID DESC "; $comments_array = $wpdb->get_results($querystr, OBJECT); if( $comments_array ): ?> <h2>Your Recent Posts</h2> <ul> <?php $count = 0; $page = 0; foreach ( $comments_array as $comment ): if($count++ % 0) $page++; setup_postdata( $comment ); echo "<li><a href='". get_bloginfo( 'url' ) ."/?p=".$comment->comment_post_ID.($page > 1 ? '-page-'.$page : '')."#comment-".$comment->comment_ID."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>"; endforeach; ?> </ul><?php endif; endif; ?>Forum: Hacks
In reply to: Creating a Comment History?I’ve never used WP-Paginate…
Could you please show what the URL of comments page 2 looks like ?
Chances are you only need to add a parameter la &page=2 in the URL to access it, and I can help you include this in the above code…Forum: Hacks
In reply to: Remove sidebarYeah, I managed to remove a sidebar I registred…
Try placing this code at the end of theme’s functions.php. If it works there, it is probably also possible from within a plugin. Not sure, though.
Forum: Hacks
In reply to: Creating a Comment History?Well, this one isn’t harder, but this one could depend on your theme, so no certain answer here.
Take a look at a link to a comment on your blog. You should see an anchor at its end, by example :
#comment-672
(Same on this forum : click on the # on left side of your last post to see an anchor.)
All you have to do is modify one line of your code this way :
echo "<li><a href='". get_bloginfo( 'url' ) ."/?p=".$comment->comment_post_ID."#comment-".$comment->comment_ID."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>";Of course, it won’t work if your theme doesn’t set these anchor when displaying comments on a post…
Forum: Hacks
In reply to: Remove sidebarWould it be possible to retrieve all registered sidebars’ ID with
wp_get_sidebars_widgets()and the unregister them withunregister_sidebar( $id )?[EDIT]
I gave it a quick test, it should work.$registered_sidebars = wp_get_sidebars_widgets(); foreach( $registered_sidebars as $sidebar_name => $sidebar_widgets ) { if( $sidebar_name != 'wp_inactive_widgets' ) unregister_sidebar( $sidebar_name ); }Forum: Hacks
In reply to: Get post from image URLThanks for your answer.
Yeah, a lot of text… It would surely be too heavy to be worth it, i.e. add a not-so-important-but-still-quite-funny functionality to a plugin I’m developing.
Being a plugin, I don’t want to add custom fields to all existing posts and pages and fill the user’s database with this. But I have to admit I hadn’t thought of pre-indexing, which still is a nice idea. I could try to implement this index, but probably with a custom table instead of filling wp_meta with custom fields’ values.
Anyway… I thought I had a lead earlier sneaking around in WP’s DB and building this query :
SELECT p1.guid as image_url, p1.post_name as post_name1, p2.post_title as post_title, p2.ID as post_id, p1.post_mime_type as image_mime FROM wp_posts as p1 INNER JOIN wp_posts as p2 ON p1.post_parent = p2.ID WHERE p1.post_mime_type != '' AND p2.post_status ='publish' ORDER BY p1.ID DESC
I didn’t know that uploaded pictures where also given an entry in wp_posts… quite surprising. Looks like it’s done to link the files to the posts they were uploaded on. Although it seems this request doesn’t show files attached to a post but not inserted into its content nor used as thumbnail…I’ll keep digging.
[ Please do not bump, that’s not permitted here. ]
Forum: Hacks
In reply to: Post loop Codes… Need HelpMy guess is that i was originally chosen because used as increment.
j, k followed alphabetically.
Forum: Hacks
In reply to: Creating a Comment History?The easiest way is to have a custom page handle this.
- Go to your theme folder
- Create a new file, say recent_comment.php
- Put the above code into this file, preceded by :
<?php /* Template Name: User's Recent Comment */ ?> - In WP’s admin panel, create a new page and select “User’s Recent Comment” when choosing a page template (should be a dropdown menu on the right
- voila