dunkkan
Forum Replies Created
-
Forum: Plugins
In reply to: Retrieve a thumbnail from a post (wp_get_attachment_image)I’ve noticed an article belonging to several categories will show the ‘default’ no-image icon (?).
I guess it must be the
get_postsfunction, but I don’t know which array pass there. I cannot call for every possible category to prevent each combination : it would list a bunch of things.I need to sort just one category, which eventually will be combined with another.
Please, anybody can help ?
Forum: Plugins
In reply to: Retrieve a thumbnail from a post (wp_get_attachment_image)Okay, there we go :
<!-- starting the loop. we target one category and get just 3 posts of it --> <?php $lastposts = get_posts('category=38&numberposts=3'); foreach($lastposts as $post) : setup_postdata($post); ?> <!-- a title for each of those 3 posts, permalinked --> <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h2> <!-- detecting the attachment in the database, and sorting it --> <?php global $wpdb; $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1"); ?> <!-- printing our cool clickable thumb --> <a href="<?php the_permalink(); ?>"><?php echo get_attachment_icon($attachment_id); ?></a> <!-- closing the loop --> <?php endforeach; ?>If we want to repeat the same for another category in the same page, don’t forget to replace your
<?php get_header(); ?>by a new<?php get_header(); rewind_posts(); ?>in the beggining of your template.Forum: Plugins
In reply to: Retrieve a thumbnail from a post (wp_get_attachment_image)In this topic I think I found the solution.
Forum: Fixing WordPress
In reply to: a list of months … linking always to a determinated categoryI found a plugin :
http://kwebble.com/blog/2007_08_15/archives_for_a_category(It was in thisthreat.)
Forum: Fixing WordPress
In reply to: Listing Archives By Author and CategoryThanks pretty much
Forum: Plugins
In reply to: Pull latest attachment from post?I’m trying to set three posts like this (excerpts):
thumb—–thumb—–thumb
words—–words——words
words—–words——words
words—–words——wordsThe code above only will show the first thumbnail for the first post.
I use
get_poststo set the multiple loops:<?php $posts = get_posts('numberposts=1&category=18'); foreach($posts as $post) : setup_postdata($post); ?> <?php postimage('thumbnail'); ?> <?php the_excerpt(); ?> <?php endforeach; ?>In the second and third post I use an
&offset=1and&offset=2respectively, which I add to theget_postsfunction.
I’ve put as well therewind_postsfunction at the begining of the template, so the three excerpts shows perfectly. But not the thumbs #2 and #3.I think I could fix it by arranging some arguments or arrays in the function.php, but I’m lost at this point. I tried to use the
get_children, which requires once again some arguments I ignore.If anybody can provide any tip…
Forum: Plugins
In reply to: attachments associated with a postBy the way, I’m trying to set three posts like this (excerpts):
thumb—–thumb—–thumb
blabla—–blabla——blabla
blabla—–blabla——blabla
blabla—–blabla——blablaBut the code avobe only shows the first thumbnail for the first post.
I use this loop for the first post:
<?php $posts = get_posts('numberposts=1&category=18'); foreach($posts as $post) : setup_postdata($post); ?> <!-- the code to print the thumbnail --> <a href="<?php the_permalink() ?>"><?php $files = get_children("post_parent=$id&post_type=attachment&post_mime_type=image"); if($files){ $keys = array_keys($files); $num=$keys[0]; $thumb=wp_get_attachment_thumb_url($num); print "<img src=$thumb class=fade>"; } ?></a> <?php the_excerpt(); ?> <?php endforeach; ?>In the second and third post I use an
&offset=1and&offset=2respectively which I add to theget_postsfunction. I have put as well therewind_postsfunction at the begining of the template, so the three excerpts shows perfectly.Thanks for any tip.
Forum: Plugins
In reply to: attachments associated with a postThanks guys that was really useful.
A tip for the begginers like me:
If you wrapp the whole code with that
<a href="<?php the_permalink() ?>"> thecodepostedabove </a>you make the thumbnail click to the post.Forum: Fixing WordPress
In reply to: Limit the number of words in excerpt without plugins…Hey guys, it worked for me like a charm. I just created a functions.php file I didn’t have, and put there the first part of bechster code, then, in my index.php, where I need to show tiny excerpts (and instead of a classical
<?php the_excerpt(); ?>), I pasted the second part of the code.I’m using the last WP version.
Forum: Plugins
In reply to: two categories, two different placed homonym tagsWell I’m thinking I’ll do the “not so perfect” solution, which is quite perfect as well. But if someone have some smart idea I’ll be checking it.
Forum: Fixing WordPress
In reply to: Getting image to show in excerptHi, there’s a wonderful plugin
Forum: Fixing WordPress
In reply to: ulpoading files written in NotepadThanks guys for the support, I guess it was something related to my ftp uploader.
Forum: Plugins
In reply to: only load a script in the front pageThanks a lot Moshu,
If I understand it well, this code in the header should do the work (I’m not sure at all about the php syntax):
<?php if(!is_front_page()){ ?> <!-- the path for the library --> <script type="text/javascript" src="library/jquery-1.2.6.min.js"></script> <!-- a little script or script's path --> <script type="text/javascript"> function mouseOver() { document.titre.src ="images/title2.png"; } function mouseOut() { document.titre.src ="images/title.png"; } </script> <!-- and several other scripts / script's paths here --> <?php } ?>Is it sure to go this way ?
I mean, to save some bandwith, what it’s better: call for the script’s paths or write them all along the html ?Forum: Themes and Templates
In reply to: Need a big search formWell Thanks ! all is working now. My problem was I was missing the comma after the height: 54px ; – we are under too much screen radiation I guess, at least me, I could be this night still changing pixels to an open attribut without any external view… I’ve set the styles for the button as well, and it’s working like a charm. Thanks Evita for that feedback.
Forum: Themes and Templates
In reply to: Need a big search formHi Darran, sorry here it goes:
#searchform { width: 254px; height: 54px margin: 10px auto; padding: 5px 3px; text-align: center; } #searchform #s { width: 254px; height: 54px padding: 2px; } #searchsubmit { padding: 1px; }The width reacts well, but there’s no response from the height.
Then :
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> <input id="s" type="text" onblur="if(this.value == '') {this.value = 'Search';}" onfocus="if(this.value == 'Search') {this.value = '';}" value="Search" name="s"/> <input type="submit" name="submit" value="Go" id="searchsubmit"/> </form>Maybe is impossible and every browser out there displays a standart line height which you cannot touch, but I remember have seen some search boxes quite big than the usual.
Thanks to give it a look.