News
Working on a new theme called WordCult
So I have been really busy, and haven’t been able to put up a new post since I got back from WordCamp Denver.
Working on some clients site’s and also a WordPress theme!I have finished about 80% of the theme which is based off my current theme located on my personal blog site: TheFrosty. TheFrosty is using version 0.1 of the theme, which has many faults and bugs. I have fixed many of them, and probably added a few others.
In version 0.2 I’ve added a new jQuery “featured posts” loader and the option for sticky posts. I have also fixed a lot of CSS errors, it should W3C comply :).
Also in the newer version I have tried to add more to the admin panel, in ways of options.
If you would like to download this theme and test it out before I release it to the community please let me know. I would love to get some feedback or ideas on what you’ve got to say. Just use the contact form or send me a message on Twitter.
Once you’ve got the theme..
Let me know what you think! Leave you comments and feedback. I am also trying to get a forum up on the site as well.
Thanks!
Frosty
Update for 0.2:
I’ve updated my personal site: TheFrosty to the latest version of WordCult (0.2). I’ve already found some small bugs and CSS fixes that need to be taken care of. Also I don’t think that the Adsense display is working correctly.
If you’ve noticed any issues please contact me or leave a comment.
Update for 0.2.1:
The new version, 0.2.1 brings in some integration from Justin Tadlocks Widgets Reloaded plugin. It’s fully integrated into the theme. So you’ll notice some widgets disappear and be replaced by others. If you need to get them back Justin makes a plugin that will “release” the old widgets on your new theme install.
Update: 0.3
Get the newest version of WordCult, download Version 0.3 from this page.
News
How to: Show/Hide any div box with jQuery in WordPress
If you take a look at my current sidebar (right) and see the heading Google Search you’ll notice that when you click it the Google Search box show’s into view.
Let me show you how this is done.
First make sure that your WordPress site is calling jQuery, buy pluggin this code into our header.php
file above the <?php wp_head(); ?>
text:
<?php wp_enqueue_script('jquery'); ?>
Then anywhere above the </head
>, plug this code in:
<script type="text/javascript"> jQuery(document).ready(function() { // hides the slickbox as soon as the DOM is ready jQuery('#toggle-search').hide(); // toggles the slickbox on clicking the noted link jQuery('a#slick-slidetoggle').click(function() { jQuery('#toggle-search').slideToggle(400); return false; }); }); </script>
That’s simple, huh. Okay now lets write the Search code:
<h2><a href="#" id="slick-slidetoggle">Google Search</a></h2> <div id="toggle-search" style="padding:10px;"> <form method="get" id="search" action="<?php bloginfo('home'); ?>/"> <div> <input type="text" value="Enter Keyword" onclick="this.value='';" name="s" id="s" /> <input type="text" name="search-button" id="search-button" value="<?php _e('Search') ?>" /> </div> </form> </div>
That’s it.
News
How to: Limiting the posts in you archive widget
I have show you how to create a custom widget in a previous post. But how about adding and additional “Archives” widget that won’t list the last 3 years (if you’ve been around that long) in month form stretching down your whole sidebar?
Well, lets take a look at the original code found in the widgets.php
file in the ./wp-includes/
folder.
<?php /** * Display archives widget. * * @since 2.2.0 * * @param array $args Widget arguments. */ function wp_widget_archives($args) { extract($args); $options = get_option('widget_archives'); $c = $options['count'] ? '1' : '0'; $d = $options['dropdown'] ? '1' : '0'; $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']); echo $before_widget; echo $before_title . $title . $after_title; if($d) { ?> <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c"); ?> </select> <?php } else { ?> <ul> <?php wp_get_archives("type=monthly&show_post_count=$c"); ?> </ul> <?php } echo $after_widget; } /** * Display and process archives widget options form. * * @since 2.2.0 */ function wp_widget_archives_control() { $options = $newoptions = get_option('widget_archives'); if ( isset($_POST["archives-submit"]) ) { $newoptions['count'] = isset($_POST['archives-count']); $newoptions['dropdown'] = isset($_POST['archives-dropdown']); $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_archives', $options); } $count = $options['count'] ? 'checked="checked"' : ''; $dropdown = $options['dropdown'] ? 'checked="checked"' : ''; $title = attribute_escape($options['title']); ?> <p><label for="archives-title"><?php _e('Title:'); ?> <input class="widefat" id="archives-title" name="archives-title" type="text" value="<?php echo $title; ?>" /></label></p> <p> <label for="archives-count"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="archives-count" name="archives-count" /> <?php _e('Show post counts'); ?></label> <br /> <label for="archives-dropdown"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /> <?php _e('Display as a drop down'); ?></label> </p> <input type="hidden" id="archives-submit" name="archives-submit" value="1" /> <?php } ?>
Simple enough? Or not..
Anyway lets just add on and change a few things. Then will add the final code to your functions.php
file.
Okay, starting with the first function: wp_widget_archive
and rename to widget_archive_limit
Should look like this now:
function widget_archives_limit($args) {
Then under the this line:
$title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']);
Add:
$limit = empty($options['limit']) ? __('Limit') : apply_filters('widget_limit', $options['limit']);
At this line:
<?php wp_get_archives("type=monthly&format=option&show_post_count=$c&limit=$limit"); ?>
We have added in &limit=$limit
. The same goes for the second wp_get_archives
:
<?php wp_get_archives("type=monthly&show_post_count=$c&limit=$limit"); ?>
At the end of this code add:
wp_register_sidebar_widget('archives limit', __('Archives Limit'), 'widget_archives_limit', $widget_ops);
The whole code should look like this:
function widget_archives_limit($args) { extract($args); $options = get_option('widget_archives'); $c = $options['count'] ? '1' : '0'; $d = $options['dropdown'] ? '1' : '0'; $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']); $limit = empty($options['limit']) ? __('Limit') : apply_filters('widget_limit', $options['limit']); echo $before_widget; echo $before_title . $title . $after_title; if($d) { ?> <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c&limit=$limit"); ?> </select> <?php } else { ?> <ul> <?php wp_get_archives("type=monthly&show_post_count=$c&limit=$limit"); ?> </ul> <?php } echo $after_widget; } wp_register_sidebar_widget('archives limit', __('Archives Limit'), 'widget_archives_limit', $widget_ops);
That takes care of the widget its self, now we need to create the controls. Once again find the second function and change wp_widget_archive_control
to widget_archives_limit_control
Find this line:
$newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"]));
and add this line below:
$newoptions['limit'] = strip_tags(stripslashes($_POST["archives-limit"]));
Then find this line:
$title = attribute_escape($options['title']);
and add this line below:
$limit = attribute_escape($options['limit']);
Finally look for this line:
<label for="archives-dropdown"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /> <?php _e('Display as a drop down'); ?></label> </p>
and add this line below:
<p><label for="archives-limit"><?php _e('Limit (enter a number):'); ?> <input class="widefat" id="archives-limit" name="archives-limit" type="text" value="<?php echo $limit; ?>" /></label></p>
then register the widget controls:
wp_register_widget_control('archives limit', __('Archives Limit'), 'widget_archives_limit_control' );
The code should look like this:
function widget_archives_limit_control() { $options = $newoptions = get_option('widget_archives'); if ( isset($_POST["archives-submit"]) ) { $newoptions['count'] = isset($_POST['archives-count']); $newoptions['dropdown'] = isset($_POST['archives-dropdown']); $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"])); $newoptions['limit'] = strip_tags(stripslashes($_POST["archives-limit"])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_archives', $options); } $count = $options['count'] ? 'checked="checked"' : ''; $dropdown = $options['dropdown'] ? 'checked="checked"' : ''; $title = attribute_escape($options['title']); $limit = attribute_escape($options['limit']); ?> <p><label for="archives-title"><?php _e('Title:'); ?> <input class="widefat" id="archives-title" name="archives-title" type="text" value="<?php echo $title; ?>" /></label></p> <p> <label for="archives-count"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="archives-count" name="archives-count" /> <?php _e('Show post counts'); ?></label> <br /> <label for="archives-dropdown"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /> <?php _e('Display as a drop down'); ?></label> </p> <p><label for="archives-limit"><?php _e('Limit (enter a number):'); ?> <input class="widefat" id="archives-limit" name="archives-limit" type="text" value="<?php echo $limit; ?>" /></label></p> <input type="hidden" id="archives-submit" name="archives-submit" value="1" /> <?php } wp_register_widget_control('archives limit', __('Archives Limit'), 'widget_archives_limit_control' );
The final code:
/** * Display archives widget. * * @since 2.2.0 * * @param array $args Widget arguments. */ function widget_archives_limit($args) { extract($args); $options = get_option('widget_archives'); $c = $options['count'] ? '1' : '0'; $d = $options['dropdown'] ? '1' : '0'; $title = empty($options['title']) ? __('Archives') : apply_filters('widget_title', $options['title']); $limit = empty($options['limit']) ? __('Limit') : apply_filters('widget_limit', $options['limit']); echo $before_widget; echo $before_title . $title . $after_title; if($d) { ?> <select name="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo attribute_escape(__('Select Month')); ?></option> <?php wp_get_archives("type=monthly&format=option&show_post_count=$c&limit=$limit"); ?> </select> <?php } else { ?> <ul> <?php wp_get_archives("type=monthly&show_post_count=$c&limit=$limit"); ?> </ul> <?php } echo $after_widget; } wp_register_sidebar_widget('archives limit', __('Archives Limit'), 'widget_archives_limit', $widget_ops); /** * Display and process archives widget options form. * * @since 2.2.0 */ function widget_archives_limit_control() { $options = $newoptions = get_option('widget_archives'); if ( isset($_POST["archives-submit"]) ) { $newoptions['count'] = isset($_POST['archives-count']); $newoptions['dropdown'] = isset($_POST['archives-dropdown']); $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"])); $newoptions['limit'] = strip_tags(stripslashes($_POST["archives-limit"])); } if ( $options != $newoptions ) { $options = $newoptions; update_option('widget_archives', $options); } $count = $options['count'] ? 'checked="checked"' : ''; $dropdown = $options['dropdown'] ? 'checked="checked"' : ''; $title = attribute_escape($options['title']); $limit = attribute_escape($options['limit']); ?> <p><label for="archives-title"><?php _e('Title:'); ?> <input class="widefat" id="archives-title" name="archives-title" type="text" value="<?php echo $title; ?>" /></label></p> <p> <label for="archives-count"><input class="checkbox" type="checkbox" <?php echo $count; ?> id="archives-count" name="archives-count" /> <?php _e('Show post counts'); ?></label> <br /> <label for="archives-dropdown"><input class="checkbox" type="checkbox" <?php echo $dropdown; ?> id="archives-dropdown" name="archives-dropdown" /> <?php _e('Display as a drop down'); ?></label> </p> <p><label for="archives-limit"><?php _e('Limit (enter a number):'); ?> <input class="widefat" id="archives-limit" name="archives-limit" type="text" value="<?php echo $limit; ?>" /></label></p> <input type="hidden" id="archives-submit" name="archives-submit" value="1" /> <?php } wp_register_widget_control('archives limit', __('Archives Limit'), 'widget_archives_limit_control' );
News
January 28th declared plugin developer day
Today Matt Mullenweg from MA.TT declared today official plugin developer day because the plugin directory hit 4,000 plugins, check it out: 4,000 Plugins.
-
Tips & Tricks3 months ago
WordPress Security Hacks
-
Pages2 weeks ago
Write For Us – Guest Post
-
Showcase3 weeks ago
StylizedWeb.com
-
News5 days ago
How to: Show/Hide any div box with jQuery in WordPress
-
Tips & Tricks5 months ago
Remove the title attribute using jQuery
-
Tips & Tricks2 months ago
How to: show/hide a widget in WordPress with jQuery
-
Plugins2 months ago
Top Membership plugins
-
Tips & Tricks3 weeks ago
Limit the characters that display on the_title
You must be logged in to post a comment.