Tag Archives: wordpress tutorials

How to Add Search Form to WordPress Theme

A client recently requested a search form be added to their WordPress website.  Prior to contact us, they were using the standard search widget in the their themes sidebar.  They wanted to move the search from to the menu of the theme and take it out of the sidebar completely.  Well, taking the widget out is easy enough but how can you add a new form to your theme.  It is actually pretty easy.  Just use the code below in your theme within the correct <div> tags and you will have a new search from on your site.  Let us know if you need any help or have any questions!

 


 

How to add a search form to WordPress Theme

Denver Wordpress Design

Sub-Categories Same Category Template as Parent Category WordPress

Here is another WordPress Tip for anyone who is looking to have sub-categories use the same category template as its parent category, rather than having to create separate templates for each category. Continue reading Sub-Categories Same Category Template as Parent Category WordPress

Denver Wordpress Design

How to Add Read More to WordPress Excerpts

So anytime we are asked to provide an enhancement to a WordPress Theme or WordPress install, we have decided to post our code up on our site to help out our fellow web developers and anyone who is trying to learn or maximize the functionality of WordPress.

A recent client purchased a Premium theme and contacted us to make some customizations and add functionality to the WordPress theme.  This particular client wanted the packaged widgets to display excerpts and not the pre-coded pulled content from posts.

The original code looked like this:

<?php the_content_limit(240, ‘read more &raquo;’); ?>

Great easy enough, all we had to do was take that out and add the following:

<?php the_excerpt(); ?>

Worked like a charm, but something was missing.  The client liked the automatic read more text and wanted that to remain as a built in function of the widget.  Well if this is the case you have a few options, here are two options below:

First you could add the following code:

<?php the_excerpt(); ?>

and add the following code directly below:

<a href=”<?php echo get_permalink(); ?>”> [ Read More → ]</a>

Or the other option is to add the following code to your functions.php file and it will automatically update all excerpts used in the WordPress install: (we chose this option)

<?php function excerpt_ellipse($text) {

return str_replace(‘[…]’, ‘ <a href=”‘.get_permalink().'”>Read more…</a>’, $text); }

add_filter(‘the_excerpt’, ‘excerpt_ellipse’);

?>

 

References:

http://wordpress.org/support/topic/excerpts-no-read-more-link

http://codex.wordpress.org/Excerpt

 

Leave a comment if you have any questions!  Thanks for reading!