Tag Archive for 'wordpress'

Using WP_Query to create custom queries

while reading my usual RSS feeds I stumbled upon this article on displaying your latest post.

It took me eye as I have been busy implementing similar things for my upcoming website, except I have been using WordPress’ WP_Query function to achieve the same results.

Basically WP_Query is used to create a seperate mini-loop outside of your main loop.  It has many advantages over using a custom SQL query like

  1. You don’t need to know proper SQL syntax
  2. It’s a core WordPress function, so if the database structure changes it will still work
  3. is more concise and uses less code
  4. highly customisable in that you can easy modify the post parameters (specify category, author, sort order, etc.)

The below is just a simple demo the grabs a link to the latest post.  It shows how easy WP_Query really is to use.


< ?php

$my_query = new WP_Query('showposts=1');
while ($my_query->have_posts()) : $my_query->the_post();
echo '<a href="' . get_permalink() . '">' . the_title('','',FALSE) . '</a>';
endwhile;

?>

(2 votes, average: 5 out of 5) Loading ... Loading ... Comments

WP-LightForm

WP-LightForm, the prettiest WordPress contact form.

I haven’t had time to update this plugin for WordPress 2.7 so for the moment I am unable to help with any queries / problems.  As far as I know there are some conflicts with the mootools this plugin uses and the jQuery WordPress uses. 

Description

WP-LightForm is an AJAX / PHP contact form with spam protection, form validation and custom form elements.

This plugin is based on LightForm by Jeeremie, and utilises FormCheck for form validation and Niceforms for custom form elements. To get a feel for what WP-LightForm is really about, click the screenshot below and try the interactive demo.

WP-LightForm Screenshot

See WP-LightForm in Action

Installation

  1. Download the latest copy of WP-LightForm and extract the archive.
  2. Open send.php with a text editor and enter the email address you would like to use as the recipient of the contact form in the $to parameter.
  3. Upload the wp-lightform directory to your WordPress installation’s wp-content/plugins/ directory.
  4. Go to the Plugins page in your WordPress Administration area and click ‘Activate’ for WP-LightForm.
  5. Enter the shortcode [LightForm] in the WordPress post/page you would like to display the contact form.

Frequently Asked Questions

How can I modify the layout of the contact form?
At the core of WP-LightForm is a XHTML Form element, to add or modify elements you can change the $formoutput string in wp-lightform.php as you would a normal XHTML document. To modify the css styles to better suit your site you will need to change css/lightform.css.

What browsers do you support?
Testing has been done in Firefox 2 along with Internet Explorer 6 & 7. Theoretically it should work on any javascript enabled browser, if not let me know by leaving a comment.

Does WP-LightForm only work on WordPress 2.5.1 and later?
Good question, my testing concludes that it definitely does work in version 2.5.1. Anything above and below that is untested, so if you decide to give this plugin a try on any other version please let me know how it went by leaving a comment.

Download

Download WP-LightForm Download WP-LightForm (version 0.4, 17 June 2008)

If you enjoyed this plugin and want to contribute to the development, then do so by helping me maintain adequate levels of caffeine in my bloodstream.

Buy Me A Coffee Buy me a Coffee

Changelog

Version 0.4

  • Formcheck image pre-loading disabled in Internet Explorer as images were appearing at the top of the screen

Version 0.3

  • AJAX message sending now works successfully with Internet Explorer 6 & 7
  • utf-8 encoding of the email to support international characters
  • Recipient email address is now to be added directly to send.php for security reasons
  • CSS modified to hide the scrollbar in the textarea for Internet Explorer 6 & 7
  • CSS styled form elements to avoid conflicts with theme defaults
  • Fixed pre-loading of formcheck images in everything but Internet Explorer 6
  • Fixed message textarea appearing above message label in Internet Explorer 6 & 7
  • New Success / Fail images courtesy of ~dimpoart

Version 0.2

Version 0.1

  • Initial release

(6 votes, average: 4.33 out of 5) Loading ... Loading ... 168 Comments



Subscription

RSS

Email:

Tag Cloud

7 11 ACA Accident Accidents Advertisements Airport Americans Animals Army article Australian Babies Bacon Badminton Balloons Balls Banana Banks Banksy Basketball batman BBQ Beer bike Bikes Blender Blonde Blondes Bollywood Bono Borat Boss Bowling Boxing Britney Spears Bush Caratoons Cars Cartoons Cats Celine Dion Chair Charities Chaser Chat Cheerleader Cheese Chicken Children Christmas Chuck Norris Cinder Blocks Coffee Comedy Communication Computer Computer Games Computers Cooking Cops Costumes Cows Crazy Criminals Crocodiles Crooks Crows Cycling Dacning Dancing Danger Mouse Death Dinosaurs Disco Doctor Dogs Drinking Drugs Drunk Election Ellen Emo Exercise Explosions Eye Chart facebook Faces Fail Family Guy Fancy Dress Farmer Farting Feminism Fight Fights Finland Fire Firefighters Fireworks Food Football Gameshow Gameshows Geek german Glowsticks God Golf Golf Marriage Google Goonies Goths Graffiti Greek Grillz guitar hero Guns Gym Hancock Hands Hecklers heroes Hitler Hospital House Hunting Husbands Hyphenation Ideol Idiots Idol IKEA Illness Images Indian Infidelity Infomercial Internet Irish Jackass Jackie Chan Japan Jeans Jesus Jewellery Jokes Jokes Lawyers Juggling Karaoke Karate Kasou Kids Kobe Bryant Kwik E Mart lego Letters Life Lionel Richie lolcat Lollies LOTR Magic Management Mario Marriage Marrige Maths Meat Men Mexican Michael Jackson Midget Mime Mixtaping Mobile Phones Models Monkeys Monster Trucks Moonwalk Movies Muppets Muscles Music Music Video Musical Musicians Nerd Nerds New York New Zealand News Nintendo nurse Office old men Old People Oldies Origami Pancakes Paris Hilton Parkour Parody Party Pets Photoes Pi Pickles Pictures Pictures Cars Pizza Plane Plugin PMS Police Politics Pool Powerpoint Prank Pranks Preaching Priest Prison Quiz Rainbow Rap Rape Rapping Real Stories Rednecks Reggae Rick Rolld Riding Robot Russia Salad Fingers Science Sesame Street Sewing Sex sheep Shopping Simpsons Singing skateboard Skating skinny dipping Skunk Slide Slow Motion Smoking Soccer social networking south park Spelling Sport Sports Squirrel Stand up Star Trek Star Wars Stock Market Stunts Stupidity Superman SWAT swearing Sweded swimming Talent Show Tattoo Tech Support Television Terrorists Thiefs TMNT to the face Toilet Tools Trains Transformers Unicorn USA Vegetables video games Videos Vidoes Wall Washing WaterSlide Webcam Weird Weird Al Wife Wifes Willy Wonka Windows Women WordPress Workout WP LightForm Wrestling Yoda Zorba

Top Commenters

  • Alex (44)
  • little duck (22)
  • maynard (15)
  • bob the builder rulz (12)
  • jfed (11)
  • ozma (10)
  • biebst* babe (10)
  • keiser (8)
  • Tom @ halloween witch costume (7)
  • David Potter (7)