WordPress Goodies

A few tidbits for WordPress I picked up this week working on Psychic Coupons and a couple other sites.


This is an oldie but goody, helps a lot: http://codex.wordpress.org/Template_Hierarchy
and the PNG: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png


Here’s one from equalmark and banago at http://wordpress.org/support/topic/query-if-on-front-page-home-index :
If you’re on the front page, conditional statements:

<?php if(is_front_page() ) { ?> //do stuff <?php } ?>
— or --
<?php if(is_home() ) { //do stuff } else { //do stuff } ?>

Mvied notes: I’d just like to point out that the is_home() function is true if you’re on the main blog page, and the is_front_page() function can be the same page unless you have a static front page set, then it will only be true on that page.


Passing variables in the URL, by stvwlf from http://wordpress.org/support/topic/passing-variables-using-the-permalink-structure :

Step 1:
Create and save PHP file in plugins directory:
/* Plugin Name: Parameter
Plugin URI: http://webopius.com/
Description: A plugin to allow parameters to be passed in the URL and recognized by WordPress
Author: Adam Boyse
Version: 1.0
Author URI: http://www.webopius.com/
add_filter('query_vars', 'parameter_queryvars' );

function parameter_queryvars( $qvars )
$qvars[] = ' myvar';
return $qvars;
Step 2:
Pass var in URL href:
if (isset($wp_query->query_vars['myvar']))
print $wp_query->query_vars['myvar'];


Find and show related posts by tag: http://wordpress.org/support/topic/variables-through-get_posts-query_posts


elseloop offers a simple way to implement a “Post template based on category”: http://wordpress.org/support/topic/post-template-based-on-category-or-tag


I just want to pass my thanks to the many talented people who take the time to share their expertise on the WordPress community forum. They are adding value to the world, so, KUDOS to all you geniuses!

Posted under WebDev, WordPress

This post was written by Content Curator on April 10, 2012

Tags: , , , , , , , , , , , , , , , , ,

WordPress Template Start

Start the PHP file with this:

Template Name: Snarfer

Posted under WebDev, WordPress

This post was written by Content Curator on December 8, 2009

Tags: , , , , , , , , , ,

How to Add Thumbnails in WordPress

When a website user makes a search with WordPress,  the search results typically are shown using the search.php template file. If one chooses to do so, these results can incluse an automatically “grabbed” image thumbnail generated by the images contained in the image. Posts with no images can show a default generic image instead. And this can all be done using the Get-The-Image plugin and perhaps a bit of code tweaking.

<div style="clear: both; margin-bottom: 20px;">
<div style="float: left; width: 150px; height: 150px; margin: 0 10px 10px 0;"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php if ( function_exists( 'get_the_image' ) ) { get_the_image('width=150&height=150&image_scan=true&default_image=http://yoursite.com/default.jpg' ); } ?></a></div>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_time('F jS, Y') ?> by <?php the_author_posts_link(); ?><br />
<p>Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>

Insert this snippet, written by mercime ar wordpress.org into your loop, typically right after the beginning while-have-posts loop.

Posted under WebDev, WordPress

This post was written by Content Curator on November 16, 2009

Tags: , , , , , , , , , , , , , , , , , ,

How to fix “is not accessible. You might not have permission to use this network resource. Access is denied.” Network error with accessing XP windows shares

Trying to access a Windows XP host computer over a LAN (local area network) and get into it’s shared folders.

This little turd of an error can be really irritating. It happens when trying to access a shared folder, or any shares, on a remote, but LAN networked, Windows XP computer. After running the Network Setup Wizard on the host computer, and enabling file and printer sharing, it just won’t go away. In Windows XP Professional, you can go into the explorer view settings, and disable Simple File Sharing, which didn’t fix it either.

The fix ended up being a simple registry edit, suggested by Microsoft: http://support.microsoft.com/kb/913628

Here is the process:

To resolve this issue, set the value of the restrictanonymous registry entry to 0. To do this, follow these steps:

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then double-click the following registry subkey:
  3. On the right side, double-click restrictanonymous.
  4. Make sure that the value in the Value data box is set to 0, and then click OK.
  5. Close Registry Editor.
  6. Restart the computer.

This worked like a charm more than once for me.

Posted under Microsoft, Network, WordPress

Easy Post Editing with WordPress

WordPress provides an easy method with which you can update your posts easily as you view them within your site. It is simply logging into your admin area, then viewing your site as a normal visitor. You can edit articles/posts/pages as you view them.

Here’s how:
Login to your site’s Admin area. This is usually something like “http:///www.yoursite.com/wordpress/wp-admin”.
Once logged in you’ll see a link at the top of the admin page that you’re looking at (just following your website name) that says View Site >> . Click It.
Now you’re viewing your website. Simply go view the page that you want to edit. You’ll notice a link below the article that reads Edit or “Edit this entry” or something to that effect.
Just click thet Edit link, and you’re in edit mode. Edit as usual.

Posted under WordPress

This post was written by Content Curator on October 11, 2006

Tags: , , , , , , , , , , ,