Category Archives: WordPress

First Repository Theme: Luxury

Ok so it was approved just a few days ago but my first theme has been set live within the WordPress.org repository and is free to download for all!

You can find the URL here: http://wordpress.org/extend/themes/luxury

It took me a lot longer than I had anticipated to get everything required to meet the strict standards that the repository enforces for themes. But at the same time, it also makes for better themes. I don’t expect it to become a huge hit but it is a good start for me and the experience doesn’t hurt.

I do plan to release at least one (if not a few more themes) but have to get them coded up first.

Improving My Git Workflow

So I’ve been a small bit of work on Easy Digital Downloads over on Github. I have GitHub for Windows which I like but have run into a small issue when it comes to creating a smooth workflow. So as it stands right now, I have the repository forked to my account. I then open up GitHub for Windows and clone the repository to my local computer.

But, within GitHub for Windows it has a setting for a default directory which I have set to (C:/wamp/www/git-stuff) so the repository gets cloned to there. Then I have to pull from the master EDD repository if there are updates. From there I copy the git-stuff cloned repository over to a WP install for testing. Once I’m done I send the copied repository back over to the git-stuff repository and then upload back to GitHub and then issue a pull request.

What I would really like to do is just clone my forked repository straight into whatever WP install I need, work on it and then just have to upload it straight from there instead of doing the extra steps of copying. I’m sure there is a way to do this through the command line but my knowledge with the command line is lacking unfortunately.

If anybody comes across this and knows a better solution, mind leaving a comment?

Using A Google Custom Font For Display In The WordPress Editor

This is only for the display in TinyMCE and not to actually give the WordPress editor font selection. I had to get this working for a theme I was developing for the theme repository so that when creating a post you see the same thing in the backend as you would on the front.

Props goes out to Helen Hou-Sandi for her help over on Twitter.

So as you can see, you just need to use @import for the font to get it working within TinyMCE within editor-style.css.

@import url(http://fonts.googleapis.com/css?family=Lato);

I had originally searched for this method but couldn’t find anything on Google, the only thing I could find was actually adding in font selection to TinyMCE and not just for the display of the font.

Remove ShareThis Buttons From Post Excerpts

This is for the ShareThis WordPress plugin found at http://wordpress.org/extend/plugins/share-this/

In your theme’s functions.php file you’ll want to input the following code…

 remove_filter( 'get_the_excerpt', 'st_remove_st_add_link', 9 );
 remove_filter( 'the_excerpt', 'st_add_widget' );

This will remove the buttons from displaying on pages like the homepage, search results, category pages, etc etc. That is, assuming that your theme is coded to use the_excerpt() in template files.

If you only want to remove the buttons from say the homepage of your site, you could do something like…

if ( is_home() || is_front_page() ) {
remove_filter( 'get_the_excerpt', 'st_remove_st_add_link', 9 );
remove_filter( 'the_excerpt', 'st_add_widget' );
}

Removing Footer Links From The MusicStar 2.0 WordPress Theme

If you want to use this theme but don’t want the links in the footer here are the instructions to remove them. You’ve most likely found that just deleting the links from the footer.php file doesn’t work as it brings up a nasty message and you can’t see your site.

I won’t go into explaining making file backups or how to use FTP or how to code in HTML. If you need to learn any of that there are plenty of other sites out there that teaches it.

I would advise making all of these edits at once and then uploading the changed files back into your WP install.

Open up footer.php and remove the offending links located on line 25.

Open up Themater.php located inside the /lib/ folder and comment out or remove line 512 completely. Also in Themater.php on line 513 you’ll need to remove

wp_initialize_the_theme_load();

from within the sidebar code.

Next open up functions.php and remove line 67, the code looks like

function wp_initialize_the_theme_load() { if (!function_exists("wp_initialize_the_theme")) { wp_initialize_the_theme_message(); die; } } function wp_initialize_the_theme_finish() { $uri = strtolower($_SERVER["REQUEST_URI"]); if(is_admin() || substr_count($uri, "wp-admin") > 0 || substr_count($uri, "wp-login") > 0 ) { /* */ } else { $l = 'Designed by: <a href="http://wpcorner.com">Wordpress Themes</a> | Thanks to <a href="http://wpcorner.com/hostgator-coupon/">Hostgator Coupon</a>, <a href="http://broadwaytickets.co/the-book-of-mormon-eugene-oneill-theatre">Book of Mormon Broadway</a> and <a href="http://broadwaytickets.co/mary-poppins-new-amsterdam-theatre">Mary Poppins Broadway</a>'; $f = dirname(__file__) . "/footer.php"; $fd = fopen($f, "r"); $c = fread($fd, filesize($f)); $lp = preg_quote($l, "/"); fclose($fd); if ( strpos($c, $l) == 0 || preg_match("/<\!--(.*" . $lp . ".*)-->/si", $c) || preg_match("/<\?php([^\?]+[^>]+" . $lp . ".*)\?>/si", $c) ) { wp_initialize_the_theme_message(); die; } } } wp_initialize_the_theme_finish();

Finally open up header.php and on line 1 remove the following code

<?php function wp_initialize_the_theme() { if (!function_exists("wp_initialize_the_theme_load") || !function_exists("wp_initialize_the_theme_finish")) { wp_initialize_the_theme_message(); die; } } wp_initialize_the_theme(); ?>

With all of that removed the theme should be working and the links in the footer should be gone.

You’re welcome.

Custom Template Pagination Fix When Set As Front Page

Had a custom template that I set as the Front Page for a site but couldn’t get pagination working correctly. Fortunately found a fix thanks to Devin Price (@devinsays) over on a blog at http://mondaybynoon.com/20110516/wordpress-posts-per-page-per-custom-post-type/#comment-42451

Going to repost the code here but all credit goes to Devin Price of http://www.wptheming.com/

if ( get_query_var( 'paged' ) )
     $paged = get_query_var( 'paged' );
     elseif ( get_query_var( 'page' ) )
     $paged = get_query_var( 'page' );
     else
     $paged = 1;

WordPress Theme: Steele

Finally! My first actual WordPress theme is ready to be released to the public. In case you are wondering, yes…..it is free!

It is a little low on overall features for now but I will be adding more updates to it later on. I just had to get it to the point where it was good enough to release as I’ve put it off far too long.

A rather bland color scheme as well but I do plan on adding different color options later on although if somebody does download it and can come up with a color scheme feel free to get in contact with me!

The download is at the link below. Feel free to download the theme and use it if you want, tell your friends and neighbors while you’re at it.

Preview picture for the Steele WordPress Theme

Name: Steele
Version: 1.0
Release Date: 11/8/2011
Demo: http://jarretcade.net/

Download Link: http://jarretcade.net/wpthemes/steele/steele.zip

If you notice any bugs with the download please send me an email through my contact form located at http://jarretcade.com/email-me

Note: If you want to be kept up to date on new theme releases as well as updates to themes please subscribe to my mailing list at http://jarretcade.com/wordpress-themes

Some elements from the TwentyEleven theme were borrowed and used in this theme. Steele does have some features to allow translations but I don’t believe that they are fully supported just yet.

Check If Post Title Exists In WordPress

I was working on a theme and needed to display a link to the post on an archive page when there wasn’t a post title given for that post. It’s rather simple but I figured I’d post it here for anybody else looking.

<?php if ( the_title( ' ', ' ', false ) == "" )
      echo 'No post title';
?>

You can also add an else statement to the above code if you want it to display something if the post title does in fact exist.

<?php if ( the_title( ' ', ' ', false ) == "" ) {
      echo 'No post title';
      } else {
      echo 'The post has a title';
      };
?>