Posts Tagged ‘functions’

How Do You Do That?

4
responses

Ever wanted to do something in WordPress but just wasn’t sure how? In my experience this happens quite often, mostly with people new to WordPress. But, even the experts run into trouble sometimes. Today I thought I’d start a series of posts which will aim to explain how to do certain things in WordPress. Hopefully this will cover anything from quick tips and simple little functions, all the way up to more complex custom code and the like. So, stick around and you just might learn something. I think I’ll kick off the series with a couple simple ones… Why isn’t this plugin working with my theme? This is probably one of the most common issues I read about regarding WordPress. Sometimes even more experienced WPers can get this one wrong. Now, I’m not saying this is the solution to all problems between plugins and themes. Its just that this […]

[Continue Reading...]

How to Highlight Search Terms with jQuery

70
responses
by
on
April 10th, 2009
in
HOW-TO, WordPress FAQs

A neat way to spice up your WordPress search page is to highlight search terms within your search results. I’ve seen some tutorials on the net on how to do this, but I haven’t found one that highlights both title and post content and is a drop-in modification for WordPress. Today I will bring you this drop-in hack for highlighting search terms on your WordPress blog. Installation 1. Copy and paste the following code into your theme’s functions.php file: function hls_set_query() { $query = attribute_escape(get_search_query()); if(strlen($query) > 0){ echo ‘ <script type=”text/javascript”> var hls_query = “‘.$query.'”; </script> ‘; } } function hls_init_jquery() { wp_enqueue_script(‘jquery’); } add_action(‘init’, ‘hls_init_jquery’); add_action(‘wp_print_scripts’, ‘hls_set_query’); If you are having issues with copy-paste from this blog, here is a link to the same code in a txt file: Code to insert into functions.php 2. Copy and paste the following code into your theme’s header.php file (just before […]

[Continue Reading...]

If, Then, Else

33
responses
by
on
August 9th, 2008
in
WordPress

Ever become brave enough to look inside of a WordPress php file? Specifically, a php file from a theme? If you have, you may have noticed that they are filled with If, Then, and Else statements. If you have no idea what these mean, this post is for you. Php has always been a pain for me to understand, but if you think about it in a logical manner, it begins to make sense. If, then and else statements are used as a means of making decisions, similar to the way you and I make decisions in the real world. Here is an example of how this logic works in WordPress. < ?php if (have_posts()) : ?> The if statement within that php function is asking if there are posts. If the blog has posts, WordPress begins processing what is known as “The Loop“. <? php while (have_posts()) : the_post(); […]

[Continue Reading...]



Obviously Powered by WordPress. © 2003-2013

page counter
css.php