How to Add Thumbnails in WordPress
When a website user makes a search with WordPress, the search results typically are shown using the search.php template file. If one chooses to do so, these results can incluse an automatically “grabbed” image thumbnail generated by the images contained in the image. Posts with no images can show a default generic image instead. And this can all be done using the Get-The-Image plugin and perhaps a bit of code tweaking.
<div style="clear: both; margin-bottom: 20px;">
<div style="float: left; width: 150px; height: 150px; margin: 0 10px 10px 0;"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php if ( function_exists( 'get_the_image' ) ) { get_the_image('width=150&height=150&image_scan=true&default_image=http://yoursite.com/default.jpg' ); } ?></a></div>
<div>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_time('F jS, Y') ?> by <?php the_author_posts_link(); ?><br />
<p>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
</div>
</div>
Insert this snippet, written by mercime ar wordpress.org into your loop, typically right after the beginning while-have-posts loop.
Posted under WebDev, WordPress
This post was written by Content Curator on November 16, 2009
How to Delete Records in PHP using MySQL
The code in the HTML/PHP markup would look something like:
<?php mysql_query("DELETE FROM yourtable WHERE yourfield='yourvalue' ")
or die(mysql_error()); ?>
This code deletes any record from the table named “yourtable” when that record’s field named “yourfield” is identically equal to “yourvalue”. The names of these objects will, of course, be replaced by the unique names that your set up uses.
Source: tizag.com – excellent tutorials on all kinds of coding, programming, and other technical stuff.
Posted under Freeware, MySQL, WebDev
This post was written by Content Curator on November 16, 2009
How to delete EISA partition
Assuming you are using Windows XP or Vista, you can use the DISKPART utility to delete these OEM partitions from DELL and other hard drives.
If you have data anywhere on the drive that you will be deleting the EISA partition from, backup that data now.
- Connect the drive to the computer. If it is an IDE drive then do this with a USB-to-IDE device, or connect the drive directly to the IDE cable. If ti is a SATA drive then do this with a USB-to-SATA device, or connect the drive direclty to the SATA controller on the motherboard. In essence, the drive must be connected to the PC and it must be “seen” by the operating system.
- XP: Start a command prompt in XP by going START > RUN > type CMD <ENTER>
Vista: Start a command prompt in Vista by going START > type CMD <ENTER> in the “Start Search” box. - In the command prompt type DISKPART <ENTER>. This starts up the DISKPART utility.
- Type LIST DISK <ENTER>. This shows the all the disks connected to the computer. Decide which one is the one you are wanting to delete the EISA / OEM partition from, and make note of which number it is.
- Type SELECT DISK n <ENTER> (where n = the number of the disk you noted in step 4)
- Type LIST PART <ENTER>. This shows the all the partitions contained in the drive you are working with. Decide which one is the one you are wanting to delete, and make note of which number it is.
- Type SELECT PART n <ENTER> (where n = the number of the partition you noted in step 6)
- Type DELETE PART OVERRIDE <ENTER>. This deletes the partition you selected.
- You are done with deleting the partition. If you want to, you may now EXTEND another adjacent partition into that free space you just created.
Enjoy!
Posted under Hardware, Microsoft
This post was written by Content Curator on December 10, 2008
How to automatically reload a page when it is finished reloading, using javascript
So, you have a web page (HTML, PHP, etc.) that you want to reload over and over. And at the same time, you want to be sure that the entire page loads before it starts the loop over again. Here is a javascript way to do just that. Simply include this script in yout HTML code, and watch the magic:
<script language="javascript"> window.onload=new Function("window.location.reload();"); </script>
Enjoy!
Posted under WebDev
This post was written by Content Curator on October 3, 2008
Making text “float” around your images using CSS
The CSS property “float”, when applied to an image will cause that image to -float- over to the left or right side of the conatiner they are within. The text flows around the image as you see in magazines and newspapers.
A simple addition to your stylesheet:
img.floatLeft {
float: left;
margin: 4px;
}
img.floatRight {
float: right;
margin: 4px;
}
Then, set the img tag to use the class:
<img class="floatRight">...
Viola!
This post was written by Content Curator on October 11, 2006