Girmay
Forum Replies Created
-
Forum: Plugins
In reply to: How to display thumbnails for related posts by author?This should do it.
function get_related_author_posts() { global $authordata, $post; $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 10 ) ); $output = '<div class="block">'; foreach ( $authors_posts as $authors_post ) { $img = featured_img($authors_post->ID); $output .= '<img src="'.$img.'"><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a>'; } $output .= '</div>'; return $output; }
function featured_img($id){ $thumb = get_post_meta($id,'THUMB',true); if($thumb){ return $thumb; } else { return "default thumb URL"; } }
Forum: Hacks
In reply to: WordPress Loop – skip posts without a thumbnailYou’re almost there…
you will need to rewind the loop count right before you continue to the next post… get your current position first…$wp_query->current_postHey , if you are still looking for the changes, you can download a copy here > https://www.websavvy.ca/wunderground.zip
Takes API key, plays with the XML tree to reflect the hierarchy
Hope that helps.Forum: Everything else WordPress
In reply to: Index of WP Content / Uploads@ipstenu agreed. people are uploading all kind of stuff to the “uploads” folder. I hate seeing the commercial theme I created uploaded there for the world to see ?? My thought is that, if the root is protected, one can only guess the wordpress-created folders (2012…2011…)
Thanks.Forum: Everything else WordPress
In reply to: Index of WP Content / UploadsNo need for all that. Just create a blank index.php or index.html and upload it to your uploads folder
Forum: Plugins
In reply to: Auto-fill/Pre-fill depending on postThis is about month late but you are in luck my friend. I did modify cf7 to do just that.
Takes “post title” puts it in a dropdown where a user can select one.
check out https://babakahn.com/2010/limo/
The “What EVENT are you attending?” is pulled from a post title.
I only need it to do dropdown but I am sure you can make it work for textboxes and such.The file you will need to modify is select.php and it is under the “modules” folder with in cf7.
Open up select.php and on line 93 (right under $label = $value;)
paste the following code.if ($name == 'events') { $cf7_dropdown = new WP_Query("cat=1"); while($cf7_dropdown->have_posts()) : $cf7_dropdown->the_post(); if ( !in_array( get_the_title(), $do_not_duplicate ) ) { $do_not_duplicate[] = array_unique($do_not_duplicate); $html .= '<option value="' . esc_attr(get_the_title()) . '"' . '>' . esc_html(get_the_title()) . '</option>'; array_push($do_not_duplicate, get_the_title()); } endwhile; } else {
Create a contact form that includes your dropdown (notice the $name = ‘events’ on top?..that is the name of my select field within my contact form)
[select events]
it doesn’t event matter what value you give it
[select events “this value doesn’t matter” “neither does this one”]
all that value will be ignored.Don not forget to change the cat ID.
new WP_Query(“cat=1”);
you can also pull from multiple cat
new WP_Query(“cat=1,3,4,2”);Forum: Themes and Templates
In reply to: P2 Theme- replies via AJAX don’t work in IE 7 or 8Replaced the p2.js file. Works fine for me now (IE7)