Professional Website Design & Development at an affordable price.

Custom Fields for Category

//add extra fields to category edit form hook add_action ( 'edit_category_form_fields', 'extra_category_fields'); //add extra fields to category edit form callback function function extra_category_fields( $tag ) { //check for existing featured ID $t_id = $tag->term_id; $cat_meta = get_option( "category_$t_id"); ?> <tr class="form-field"> <th scope="row" valign="top"><label for="cat_Image_url"><?php _e('Category Image Url'); ?></label></th> <td> <input type="text" name="Cat_meta[img]" id="Cat_meta[img]" size="3" [...]

Pretty Category Dropdown

<?php $categories = get_categories(); $select = "<select name='cat' id='cat' class='postform'>\n"; $select.= "<option value='-1'>Select category</option>\n"; foreach($categories as $category){ if($category->count > 0){ $select.= "<option value='".$category->slug."'>".$category->name."</option>"; } } $select.= "</select>"; echo $select; ?> <script type="text/javascript"><!-- var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value != -1 ) { location.href = "<?php echo get_option('home');?>/category/"+dropdown.options[dropdown.selectedIndex].value+"/"; } } dropdown.onchange = [...]

Include Post Tags in Search

function custom_search_where($where){ global $wpdb; if (is_search()) $where .= "OR (t.name LIKE '%".get_search_query()."%' AND {$wpdb->posts}.post_status = 'publish')"; return $where; } function custom_search_join($join){ global $wpdb; if (is_search()) $join .= "LEFT JOIN {$wpdb->term_relationships} tr ON {$wpdb->posts}.ID = tr.object_id INNER JOIN {$wpdb->term_taxonomy} tt ON tt.term_taxonomy_id=tr.term_taxonomy_id INNER JOIN {$wpdb->terms} t ON t.term_id = tt.term_id"; return $join; } function custom_search_groupby($groupby){ global [...]

Image Insert CSS

img.alignright {float:right; margin:0 0 1em 1em} img.alignleft {float:left; margin:0 1em 1em 0} img.aligncenter {display: block; margin-left: auto; margin-right: auto} .alignright {float:right; } .alignleft {float:left; } .aligncenter {display: block; margin-left: auto; margin-right: auto}

HTML Friendly Excerpts

/* Code that preserves HTML formating to the automatically generated Excerpt */ /* Also modifies the default excerpt_length and excerpt_more filters. */ /* Code tested on WordPress Version 3.1.3 */ function custom_wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) { //Retrieve the post content. $text = get_the_content(''); //Delete all shortcode tags from [...]

Customize Your Login Page

Change the Stylesheet Put the following code in the functions.php file: function custom_login() { echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/custom-login/custom-login.css" />'; } add_action('login_head', 'custom_login'); Create a folder in your theme’s folder and call it “custom-login“. This folder will store the css and images for the custom login page. Inside the custom-login folder create a new stylesheet [...]

CSS Custom Fonts

Use custom fonts in your CSS.

Using Post Formats

Using post formats in theme.

Change the Dashboard Footer Text

Add the following code to your functions.php file to change the dashboard footer text.

Put Log-in/Log-out Link in Custom Menu

Put the login - logout link in a custom nav menu by adding the following code to your functions.php file.

Remove Submenus in Admin

Sometimes you don't want users to be able to access certain submenu links in the admin. Add the following code to functions.php to make these unavailable.

Add Horizontal Rule Button in Text Editor

Add a horizontal rule buttom to the text editor by placing the following code to the functions.php file.

Change Logo in WordPress Admin

To change the logo in Wordpress Admin, create a 16 x 16 image and name it adminlogo.png. Put it in the theme directory in the 'images' file. Next put the following code in the functions.php file:

Add Login/Logout to Custom Menu

This code puts the login/logout link in "menu-3".

Custom Post Type with Custom Taxonomy

Code snippet for Custom Post Type with Custom Taxonomy.

Re-direct Login to Starting Point

Redirect the login to the page loggin in from.

Single post templates for specific categories

If you want to display single post page using different single post template, then wordpress in_category() function will help to create different single post template.

Change the theme from database.

Open phpMyAdmin, go to your wp database. Open wp_options table. Search for three option_name – template, stylesheet, and current_theme.  Change the value to the name of the theme you want.

Project Definition

Consultation to define what you would like to accomplish with your website. Establish the type of design style which appeals to you. Discuss content, graphics, design ideas, features required. Draft a Project plan and contract. Register your domain name and purchase website hosting.

Html in Excerpts

Sometimes you may want to be able to use html in your excerpts.

List of Posts in a Category

To create a list of posts use the following code.  However this will not work in the header.php

 <ul>
 <?php
 global $post;
 $myposts = get_posts('numberposts=5&offset=1&category=1');
 foreach($myposts as $post) :
   setup_postdata($post);
 ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
 <?php endforeach; ?>
 </ul>

Change Length of Excerpt

To change the length of the post excerpt use this code in your functions.php file.

HTML Characters

Here is a long list of html characters.

Creating a new taxonomy

How to create a new taxonomy in wordpress.

Slider by webdesign