<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>scriptflipper.com &#187; code</title>
	<atom:link href="http://www.scriptflipper.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.scriptflipper.com</link>
	<description>online portfolio of Michael Ciccarelli</description>
	<lastBuildDate>Wed, 30 Jun 2010 22:14:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Alternate Post Styling</title>
		<link>http://www.scriptflipper.com/2010/03/alternate-post-styling/</link>
		<comments>http://www.scriptflipper.com/2010/03/alternate-post-styling/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 13:00:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[recentpost]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://michaelciccarelli.com/?p=692</guid>
		<description><![CDATA[On the homepage of a WordPress site I was working on, I wanted to display the most recent post completely (not just the excerpt) while the next 9 showing the excerpt only. I also wanted to include a post image and other additional meta data for better usability and also to make the latest article [...]]]></description>
			<content:encoded><![CDATA[<p>On the homepage of a WordPress site I was working on, I wanted to display the most recent post completely (not just the excerpt) while the next 9 showing the excerpt only. I also wanted to include a post image and other additional meta data for better usability and also to make the latest article stand out from the others.</p>
<p>My initial approach was to use the <strong>is_home()</strong> conditional tag from the <a href="http://codex.wordpress.org/Conditional_Tags">WordPress Codex</a>. Problem with this method was whenever you browsed through the previous 10 entries using the navigation links on the home page the next 10 articles would be displayed in the same manor as the first 10; The top article would show as a full post while the next 9 would show excerpt only, even tho the top article is not always the latest article published.</p>
<p>So what I wanted to achieve was, when a user lands on my homepage they would see the latest article&#8217;s full content and in reverse chronological order and 9 more posts showing the excerpt only. If the user clicked the navigation links (previous 10 entries) I wanted the next 10 entries to show their excerpt&#8217;s only without a full post at the top.</p>
<p>After thinking about it for a couple minutes there was a simple solution by adding a simple counter to my while loop and evaluating what number post (of 10) was being returned and returning 2 different results.</p>
<p>If the count is at 0 (1st time through the loop) and we are on the the homepage then return the_content rather then just the_excerpt:<br />
<pre><code>
&lt;?php while (have_posts()) : the_post(); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php static $ctr = 0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($ctr == &quot;5&quot; &amp;&amp; is_home()) { break; }
&nbsp;&nbsp;else { ?&gt;
&nbsp;&nbsp;&lt;div class=&quot;post&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h4&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;Permalink to &amp;quot;&lt;?php the_title(); ?&gt;&amp;quot;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h4&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p class=&quot;meta&quot;&gt;&lt;?php the_time(&#039;F jS, Y&#039;) ?&gt; | &lt;?php the_category(&#039;, &#039;) ?&gt;&lt;span class=&quot;alignright bubble&quot;&gt;&lt;?php comments_popup_link(&#039;0&#039;, &#039;1&#039;, &#039;%&#039;); ?&gt;&lt;/span&gt;&lt;/p&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;entry&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php if ($ctr == &quot;0&quot; &amp;&amp; is_home() &amp;&amp; !is_paged()) { the_content(&quot;Continue Reading...&quot;); }&nbsp;&nbsp;else if { ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php the_excerpt(&#039;Read the rest of this entry &amp;raquo;&#039;); } ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php $ctr++; } ?&gt;
&lt;?php endwhile; ?&gt;
</code></pre></p>
<p>This is a very basic example of what you can do with this, you can also use this to display the number of posts to display within your loop, rather than the default &#8220;10&#8243;, but be creative and and experiment with this to make your latest WordPress post stand out from the previous entries anywhere you might be listing your posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2010/03/alternate-post-styling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Art Of Font Embedding</title>
		<link>http://www.scriptflipper.com/2009/10/the-art-of-font-embedding/</link>
		<comments>http://www.scriptflipper.com/2009/10/the-art-of-font-embedding/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 09:28:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[article]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[cufon]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[fontface]]></category>

		<guid isPermaLink="false">http://michaelciccarelli.com/?p=822</guid>
		<description><![CDATA[Soon after launching of my latest redesign I&#8217;ve been spending a great deal of time on the use of typography throughout the site. I&#8217;ve been teaching myself different font embedding technologies in order to use a specific font of my choice, rather then the standard web safe fonts you see everyday all over the web. [...]]]></description>
			<content:encoded><![CDATA[<p>Soon after launching of my latest <a href="http://michaelciccarelli.com/design/redesign-using-the-960-grid-system/">redesign</a> I&#8217;ve been spending a great deal of time on the use of typography throughout the site. I&#8217;ve been teaching myself different font embedding technologies in order to use a specific font of my choice, rather then the standard <a href="http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html">web safe fonts</a> you see everyday all over the web. In this article I&#8217;d like to share these methods and give my brief thoughts on each.</p>
<h4>@Font-face</h4>
<p>The @font-face rule will allow you to embed a font on your server, just as you would link to images within a stylesheet. The biggest problem with @font-face, besides the issue of browser compatibility, is that most font licenses do not allow you to serve the fonts over the web. Being a web designer and all, I felt achieving identical <em>cross-platform</em> appearance throughout my site was important, so I decided not to use this method and to try something else.</p>
<div id="attachment_933" class="wp-caption aligncenter" style="width: 380px"><img src="http://www.scriptflipper.com/wp-content/uploads/2009/11/formats.png" alt="Web Fonts Embedding Support Matrix" title="@font-face browser compatiblity" width="370" height="121" class="size-full wp-image-933" /><p class="wp-caption-text">Web Fonts Embedding Support Matrix</p></div>
<h5>Installation of @font-face</h5>
<p>1. First you need to embed the font of your choice using the following CSS syntax:</p>
<p><pre><code>
@font-face {font-family: &quot;Axel&quot;;src: url(&quot;font/Axel-Regular.ttf&quot;) format(&quot;TrueType&quot;);}
@font-face {font-family: &quot;Axel&quot;;font-weight: bold;src: url(&quot;font/Axel-Bold.ttf&quot;) format(&quot;TrueType&quot;);}
@font-face {font-family: &quot;AxelSC&quot;;src: url(&quot;font/AxelSC-Regular.ttf&quot;) format(&quot;TrueType&quot;);}
@font-face {font-family: &quot;AxelSC&quot;;font-weight: bold;src: url(&quot;font/AxelSC-Bold.ttf&quot;) format(&quot;TrueType&quot;);}
</code></pre></p>
<p></p>
<p>2. Next you will reference the font to be used and declare the use of alternative fonts.</p>
<p><pre><code>
h1,h2,h3,h4,h5 {font-family: AxelSC,Georgia,Times,&#039;Times New Roman&#039;,serif;font-weight: normal;color: #333;line-height: 22px;}
</code></pre></p>
<p>Following those small steps above you&#8217;re website&#8217;s headings (h1,h2,etc.) will all use the font specified and embedded on the server, regardless of the fonts installed on the users computer. Of course as I already mentioned this method just simply is not support by all browsers, so I decided to take a different approach.</p>
<h4>Cufon</h4>
<p>Cufon is basically a new and improved version of Typeface.js, with a focus on faster and easier implementation. Cufon loads very fast, since it is all JS and nothing more and the only real problem with it is that the font cannot be selected. Since I was only really interested in using rich typography on my headings and not the main content of my site, i decided this was the best solution for me. If you run a commercial website, I wouldn&#8217;t recommend using Cufon, since as far as I know it violates EULA and copyrights due the fonts being embedded.</p>
<h5>Installation</h5>
<p>Here is a very good tutorial on how to get Cufon installed on your site: <a href="http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/">http://net.tutsplus.com/videos/screencasts/the-easiest-way-to-use-any-font-you-wish/</a> </p>
<p>Following the article above I was able to get Cufon up and running on my site within 30 minutes or so and am pleasantly surprised with it&#8217;s results on all platforms I&#8217;ve tested in.</p>
<h4>Conclusion</h4>
<p>Until recently, web designers were limited to working with the fonts of their end-users computer. Image replacement tricks and clever technologies such as sIFR have opened up new possibilities, but none of these are terribly easy to work with. We&#8217;ve recently made good progress in what is possible for type on the web because of the growing support for CSS 3&#8242;s @font-face property, as well as new technologies like Cufón and Typekit.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2009/10/the-art-of-font-embedding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Anchor Text On WordPress Post Excerpts</title>
		<link>http://www.scriptflipper.com/2009/02/better-anchor-text-on-wordpress-post-excerpts/</link>
		<comments>http://www.scriptflipper.com/2009/02/better-anchor-text-on-wordpress-post-excerpts/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 00:51:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://michaelciccarelli.com/?p=539</guid>
		<description><![CDATA[I tend to use post excerpts (the_excerpt) on the home page and archive views of a blog rather than full posts (the_content). Using the excerpt controls the size of each post and provides a clean interface for readers to scan content. However, I think it&#8217;s better to have a permalink with custom anchor text trailing [...]]]></description>
			<content:encoded><![CDATA[<p>I tend to use post excerpts (the_excerpt) on the home page and archive views of a blog rather than full posts (the_content). Using the excerpt controls the size of each post and provides a clean interface for readers to scan content. However, I think it&#8217;s better to have a permalink with custom anchor text trailing each post excerpt rather than the default [...] text providing no usability.</p>
<p>There are plugins for this, such as <a href="http://robsnotebook.com/the-excerpt-reloaded">The Excerpt Reloaded</a>. I for one always try to keep plugin usage to a minimum and this can be done very easily by adding a small function to your theme files.</p>
<p>Open your theme&#8217;s functions file or functions.php in your themes directory, if you doen&#8217;t see a functions.php file you can create it, and add the following code:</p>
<p><pre><code>//function to replace trailing text on the_excerpt
function customtrail_excerpt($text)
{
return str_replace(&#039;[...]&#039;, &#039;&lt;a href=&quot;&#039;. get_permalink($post-&gt;ID) . &#039;&quot;&gt;&#039; . &#039;Continue Reading &amp;hellip;&#039; . &#039;&lt;/a&gt;&#039;, $text);
}
add_filter(&#039;the_excerpt&#039;, &#039;customtrail_excerpt&#039;); </code></pre></p>
<p>Your post excerpts should now look something like this..</p>
<p><img src="http://www.scriptflipper.com/wp-content/uploads/2009/02/default.png" class="centered" /></p>
<h3>making the trailing text S.E.O. friendly anchor text</h3>
<p>Making the anchor text dynamic instead of a default &#8220;Read Now&#8221; or &#8220;Continue Reading&#8221; is great for Search Engine Optimization. First we need to add another function to our theme files (functions.php) that will go out and get the content of a custom field from our posts meta data. This custom field should be named &#8220;anchor&#8221; and if you populate this field while writing a post, your custom anchor text will display at the end of each post excerpt as anchor text linking to the permalink of the post, otherwise a default &#8220;Read More&#8230;&#8221; will display in the brackets.</p>
<p>Below is the updated code featuring the additional custom fields function and also some changes to the original Custom Trailing Text function I posted above. Instead of just returning static text it will look for the custom field of &#8220;anchor&#8221; and display this text, otherwise display the default &#8220;Read More&#8230;&#8221; trailing each post excerpt.</p>
<p><pre><code>//function to get custom fields outside the loop
function get_custom_field($key, $echo = FALSE) {
&nbsp;&nbsp;global $post;
&nbsp;&nbsp;$custom_field = get_post_meta($post-&gt;ID, $key, true);
&nbsp;&nbsp;if ($echo == FALSE) return $custom_field;
&nbsp;&nbsp;echo $custom_field;
}
//function to replace trailing text on the_excerpt
function customtrail_excerpt($text)&nbsp;&nbsp;{
&nbsp;&nbsp;$customanchor = get_custom_field(&#039;anchor&#039;, false);
&nbsp;&nbsp;&nbsp;&nbsp;if(!empty($customanchor)):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$anchortext = $customanchor;
&nbsp;&nbsp;&nbsp;&nbsp;endif;
&nbsp;&nbsp;&nbsp;&nbsp;if(empty($customanchor)):
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$anchortext = &#039;Continue Reading &amp;hellip;&#039;;
&nbsp;&nbsp;&nbsp;&nbsp;endif;

&nbsp;&nbsp;return str_replace(&#039;[...]&#039;, &#039;[&lt;a href=&quot;&#039;. get_permalink($post-&gt;ID) . &#039;&quot;&gt;&#039; .&nbsp;&nbsp;$anchortext . &#039;&lt;/a&gt;]&#039;, $text);
&nbsp;&nbsp;&nbsp;&nbsp;}

&nbsp;&nbsp;&nbsp;&nbsp;add_filter(&#039;the_excerpt&#039;, &#039;customtrail_excerpt&#039;);
 ?&gt;</code></pre></p>
<p>Your post excerpts should now look something like this&#8230;</p>
<p><img src="http://www.scriptflipper.com/wp-content/uploads/2009/02/custom.png" class="centered" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2009/02/better-anchor-text-on-wordpress-post-excerpts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix pagination on query_posts()</title>
		<link>http://www.scriptflipper.com/2008/07/fix-pagination-on-query-posts/</link>
		<comments>http://www.scriptflipper.com/2008/07/fix-pagination-on-query-posts/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 21:51:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[query_posts]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://michaelciccarelli.com/?p=254</guid>
		<description><![CDATA[Here is a simple solution for those of you looking to customize your WordPress theme, to use the WordPress query_posts() function to retrieve your blog posts rather than the standard loop. I created a custom Page Template named &#8220;Blog&#8221; using query_posts() and assigned this template to be used on a designated Blog page within my [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple solution for those of you looking to customize your WordPress theme, to use the WordPress query_posts() function to retrieve your blog posts rather than the standard <a href="http://codex.wordpress.org/The_Loop">loop</a>.</p>
<p>I created a custom Page Template named &#8220;Blog&#8221; using query_posts() and assigned this template to be used on a designated Blog page within my site at http://michaelciccarelli.com/blog/ (a Blog within a Blog even). I did this mainly because my original homepage didn&#8217;t really resemble a traditional blog and I wanted something more than just your average archives page that only lists the titles of all your previous blog posts.</p>
<p><strong>So here&#8217;s my Blog Page Template&#8217;s Source Code:</strong><br />
<pre><code>
&lt;?php
/*
Template Name: Blog page
*/
?&gt;
&lt;?php get_header(); ?&gt;
&lt;div id=&quot;content&quot;&gt;
&nbsp;&nbsp;&lt;div id=&quot;primary&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php
&nbsp;&nbsp;&nbsp;&nbsp;$limit = get_option(&#039;posts_per_page&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;$paged = (get_query_var(&#039;paged&#039;)) ? get_query_var(&#039;paged&#039;) : 1;
&nbsp;&nbsp;&nbsp;&nbsp;query_posts(&#039;showposts=&#039; . $limit . &#039;&amp;paged=&#039; . $paged .&#039;&amp;cat=-166,-167,-168&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;$wp_query-&gt;is_archive = true; $wp_query-&gt;is_home = false;
&nbsp;&nbsp;&nbsp;&nbsp;?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;blog-post&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent link to &lt;?php the_title_attribute(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;post-entry&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php the_content(__(&#039;Read the rest of this entry &amp;raquo;&#039;)); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;&lt;!-- /post --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php endwhile; ?&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;!-- Page Navigation --&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php if (function_exists(&#039;wp_pagenavi&#039;)) : ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;pagenavi&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php wp_pagenavi(); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php else : // Use WordPress default page navigation. ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;pages&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;older&quot;&gt;&lt;?php next_posts_link(&#039;&amp;laquo; Older Entries&#039;); ?&gt;&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;span class=&quot;newer&quot;&gt;&lt;?php previous_posts_link(&#039;Newer Entries &amp;raquo;&#039;); ?&gt;&lt;/span&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php endif; ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php else : ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;blog-post&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;h2 class=&quot;post-title&quot;&gt;&lt;?php _e(&#039;404 - Not Found&#039;); ?&gt;&lt;/h2&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;div class=&quot;post-entry&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;?php _e(&#039;Sorry, no posts matched your criteria.&#039;); ?&gt;&lt;/p&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&lt;?php endif; ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;/div&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_sidebar(); ?&gt;
&lt;/div&gt;&lt;!-- content --&gt;
&lt;span class=&quot;clr&quot;&gt;&lt;/span&gt;
&lt;?php get_footer(); ?&gt;
</code></pre></p>
<h3>Notes:</h3>
<p>The only bit you may want to alter in the function that retrieves your posts is the 3rd line in from top:<code>query_posts(&#039;showposts=&#039; . $limit . &#039;&amp;paged=&#039; . $paged .&#039;&amp;cat=-166,-167,-168&#039;);</code></p>
<p>Notice the <strong>&#038;cat=-166,-167,-168</strong> this basically says exclude the following category IDs, which in my case are portfolio categories, that I don&#8217;t want to display in my blog section. This parameter is more commonly used like <strong>cat=1,3,5</strong> which will only return posts from those categories.</p>
<p>$limit is assigned the &#8216;posts_per_page&#8217; option from your WordPress settings, this stopped working for me for some reason but not a big deal because it can be changed to something specific, like: <code>$limit = 20;</code></p>
<p><pre><code>
$wp_query-&gt;is_archive = true;
$wp_query-&gt;is_home = false;
</code></pre></p>
<p>These variables that come after the <code>query_posts()</code> are important as they force <code>posts_nav_link()</code> (and so pagination) to work, along with a few other helpful results gained for fooling WordPress into thinking we&#8217;re in the archive pages.</p>
<p><small>For the $paged stuff, see:</small> <a href="http://wordpress.org/support/topic/57912#post-312858 ">this support forum post</a> &#8211; <a href="http://wordpress.org/support/topic/152451?replies=12#post-679318">Source</a> [via <a href="http://wordpress.org/support/">WordPress Support</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2008/07/fix-pagination-on-query-posts/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>e-Commerce Solutions for WordPress</title>
		<link>http://www.scriptflipper.com/2008/04/ecommerce-solutions-for-wordpress/</link>
		<comments>http://www.scriptflipper.com/2008/04/ecommerce-solutions-for-wordpress/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 15:48:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[authorize.net]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.interwits.com/?p=156</guid>
		<description><![CDATA[WordPress is one of the most popular Content Management Systems (CMS) on the web. It&#8217;s a great application supported by a great community. I use WordPress for many of my own websites, I also recommend it to others looking to start a website that need to manage their content with little programming knowledge. I always [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress is one of the most popular Content Management Systems (CMS) on the web. It&#8217;s a great application supported by a great community. I use WordPress for many of my own websites, I also recommend it to others looking to start a website that need to manage their content with little programming knowledge. I always thought the lack of e-Commerce plugins for WordPress was odd, but never really needed to implement any shopping carts on a WordPress site. If someone required more of an actual shop than a standard website, I would steer them towards an actual e-Commerce application (ZenCart, Magento, OS Commerce etc.).</p>
<p>I decided to try out <a href="http://www.instinct.co.nz/e-commerce-post/">WP e-Commerce</a>, one of the only <em>free</em> shopping cart plugins for WordPress. My client&#8217;s website was already up and running the latest version of WordPress. So instead of selling her the idea of switching applications or using a simple shopping cart solution like <a href="http://www.e-junkie.com">e-junkie</a>, I decided to familiarize myself with some e-Commerce solutions for WordPress.</p>
<p>Unfortunately WP e-Commerce is not very stable out-of-box, even though I purchased the <a href="<br />
http://instinct.co.nz/blogshop/products-page/">Gold Cart</a> which was suppose to be more feature rich then the standard <em>free</em> version. It required some work to get it working properly with Paypal, which is the default payment gateway. Authorize.net was the preferred payment gateway of my client, mainly because she already had an established merchant account with them. Although it didn&#8217;t work right away, once I got it working properly I think it is the best gateway to use with WP e-Commerce. </p>
<p>A big turn off from using Paypal as the gateway is the fact you get redirected off the website you are on to make the payment. This isn&#8217;t all that bad, especially if you do not wish to purchase an SSL certificate for your website and will be handling your customers financial information, being redirected to a secure paypal site will cover that for you. The biggest issue I noticed with Paypal is users making payments are now required to have a paypal account, which leads to a dead-end for those customers without an account. During the checkout process Paypal requires you to create an account even if you select the options &#8220;I do not have a paypal account and would like to make my purchase using a credit card&#8221;. I proceeded to signup during my testing, my account was opened simply using the email address I provided, all appeared to be well, then before my card was charged, I was required to verify my new Paypal account by waiting for a specific paypal charge to hit my credit card. This would be fine if the sole purpose for creating my account wasn&#8217;t to make a purchase right at that moment. Who is going to wait 3-4 days to verify their Paypal account in order to make a simple purchase I should be able to make instantly.</p>
<p>So although I moved on to Authorize.net which was giving me this error whenever I proceeded to checkout:</p>
<p></p>
<blockquote><p>refId:<br />
resultCode: Error<br />
code: E00003<br />
text: The &#8216;AnetApi/xml/v1/schema/AnetApiSchema.xsd:length&#8217; element is invalid &#8211; The value &#8221; is invalid according to its datatype &#8216;Short&#8217; &#8211; The string &#8221; is not a valid Int16 value.<br />
subscriptionId:</p></blockquote>
<p></p>
<p>I decided to get this working and share with anyone else wishing to use authorize.net as their payment gateway. The problems were located in <strong>wp-shopping-cart/gold_cart_files/merchants/authorize.php</strong>. Instinct, who wrote the script, left references to their own credentials which were hard coded in the script. They probably forgot to swap out their hard coded logins and names with the proper variables of the input boxes you have set in your Payment Options. So in the end no matter what you have set on the options page, Instinct&#8217;s API access and login credentials are being passed at checkout.</p>
<h4>Fixing the Authorize.net Payment Gateway</h4>
<ul>
<ol>
<li><a href="http://michaelciccarelli.com/files/authorize_4-1-2008.zip">download the updated authorize.php file</a></li>
<li>extract the .zip archive to: <em>wp-shopping-cart/gold_cart_files/merchants/</em> overwriting the old authorize.php file</li>
<li>upload the new authorize.php file to your server</li>
<li>make sure your Authorize.net credentials are set in the Payment Options</li>
<li>You should be all set, reset your browser cache and make a test purchase</li>
</ol>
</ul>
<p>If your still having problems with the Authorize.net checkout, remove both your Authorize.net account and the WP e-Commerce plugin from &#8220;Test Mode&#8221; and try again with $1.00 item. </p>
<p>I&#8217;d like to give a a big thanks to Shayne Sanderson, who I found on the <a href="<br />
http://instinct.co.nz/blogshop/forums/">WP e-Commerce Support Forums</a>. Shayne went out of his way to help me with this, he was able to contact the lead developers at instinct for me and was very persistent on finding the problem. Shayne will soon be launching his own website to support the WP e-Commerce plugin.</p>
<p>So if you interested in adding a shopping cart to your WordPress site here are a few options that I know of:<br />
</p>
<ul>
<li><a href="http://www.e-junkie.com">e-junkie</a> &#8211; a simple shopping cart solution for selling basic products on any website. Adds an &#8220;Add to cart&#8221; button on your products page, then you are redirected to your cart on e-junkie when your ready to checkout.</li>
<li><a href="http://www.instinct.co.nz/e-commerce-post/">WP e-Commerce</a> &#8211; A free WordPress plugin for e-Commerce, very convenient and much potential but is very young and needs some work. Only works with Paypal for payment processing.</li>
<li><a href="http://instinct.co.nz/blogshop/products-page/">Gold Cart</a> &#8211; An additional module to be used with the WP e-Commerce plugin that opens more features and give you the ability to use more payment gateways. Only $15 an absolute most buy if you intend to use WP e-Commerce.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2008/04/ecommerce-solutions-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Complete WordPress/vBulletin Bridge</title>
		<link>http://www.scriptflipper.com/2007/12/complete-wordpressvbulletin-bridge/</link>
		<comments>http://www.scriptflipper.com/2007/12/complete-wordpressvbulletin-bridge/#comments</comments>
		<pubDate>Tue, 11 Dec 2007 15:54:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[vBulletin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.ciccarelli.biz/2007/12/11/complete-wordpressvbulletin-bridge/</guid>
		<description><![CDATA[Recently I was hired to install a vBulletin Message board on an established WordPress blog. While I was in the vBulletin support forums for an issue I was having, I came across a very useful WP plugin that I would highly recommend for those who wish to run these two systems together. The WordPress/vBulletin Bridge [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was hired to install a vBulletin Message board on an established WordPress blog. While I was in the vBulletin support forums for an issue I was having, I came across a very useful WP plugin that I would highly recommend for those who wish to run these two systems together.</p>
<p>The <a href="http://www.vbulletin.org/forum/showthread.php?p=1398540&amp;posted=1" title="Complete WordPress/vBulletin Bridge" target="_blank">WordPress/vBulletin Bridge</a> can be found <a href="http://www.vbulletin.org/forum/showthread.php?p=1398540&amp;posted=1" title="Complete WordPress/vBulletin Bridge" target="_blank">here</a>. Please note that a valid vBulletin license is required to download this pluggin. This means you must register an account with <a href="http://www.vbulletin.org" title="vBulletin.org" target="_blank">vBulletin.org</a> in order to verify your license status.</p>
<p>I am going to post steps that I took to get this plugin working and also some additional steps that I took to accommodate my clients needs. Keep in mind that all servers are configured different and this plugin may work on your own server flawlessly, out-of-box with out any adjustments. So I suggest to follow the developer&#8217;s installation instructions from the <a href="http://www.vbulletin.org/forum/showthread.php?p=1398540&amp;posted=1" title="Complete WordPress/vBulletin Bridge" target="_blank">plugin home page first, and if you are having issues maybe my suggestions will work for you.</a>.</p>
<p>The problems I had with the plugin were related to path issues, other than that I didn&#8217;t have any other complications. So if you are having problems with this plugin after you&#8217;ve activated it. First thing you are going to want to do is find out the actual directory path to your forums on your server and hardcode these paths into the plugin. If you do not know this then put the following script in a .php document, upload it to your vBulletin&#8217;s directory and run it, this script will return the directory path of its location. You can then copy that to your clipboard before you begin modifying the WordPress vBulletin Bridge Plugin.</p>
<p><pre><code>
&lt;?
if ($_SERVER[&#039;PATH_TRANSLATED&#039;])
{
$path = $_SERVER[&#039;PATH_TRANSLATED&#039;];
}
else if ($_SERVER[&#039;SCRIPT_FILENAME&#039;])
{
$path = $_SERVER[&#039;SCRIPT_FILENAME&#039;];
}
else
{
echo &#039;Unable to determine the path to this directory.&#039;;
exit;
}
echo substr($path, 0, (strlen($path) - 12));
?&gt;
</code></pre><br />
For this tutorial I will be using my directory path which is:<font color="#ff0000"> /home/content/html/clients/jdeiboldt/raceforaseat/forums</font> (Don&#8217;t forget to replace this directory with your own!)</p>
<p>1. Open vbbridge.php and replace all instances of:<br />
<pre><code>
chdir($_SERVER[&#039;DOCUMENT_ROOT&#039;] . get_option(&#039;vbb_VBRPATH&#039;));&nbsp;&nbsp;</code></pre></p>
<p>with:<br />
<pre><code>chdir(&#039;/home/content/html/clients/jdeiboldt/raceforaseat/forums&#039;);
$vwd=&#039;/home/content/html/clients/jdeiboldt/raceforaseat/forums&#039;;</code></pre></p>
<p>2. Completely remove/delete this line:<br />
<code>require_once(ABSPATH . &#039;wp-admin/admin-db.php&#039;);</code></p>
<p>3.Replace:<br />
<code>require_once($vwd . &#039;/includes/functions_misc.php&#039;);</code><br />
With:<br />
<pre><code>require_once(&#039;/home/content/html/clients/jdeiboldt/raceforaseat/forums/includes/functions_misc.php&#039;);
</code></pre></p>
<p>Once these changes have been made, upload the vbridge.php and functions_wysiwyg2.php file to your wp-content/plugins directory.  DO NOT create a subdirectory.</p>
<p>Activate the plugin in your WordPress Dashboard.</p>
<p>YOU MUST go to the options page before you do anything else.  Click Options, then &#8220;Vbridge Options&#8221;.</p>
<p>Define the following:</p>
<p>VB User ID:  This is the userid comment threads will be started with IF the author is NOT REGISTERED with VB.</p>
<p>VB Username: This is the username comment threads will be started with IF the author is NOT REGISTERED with VB.</p>
<p>VB Forum ID: This is the default FORUM id where all comment threads will be posted unless another is selected. This also will indicate what forum will automatically be selected in the drop down menu on the write page.</p>
<p>Forum URL: This is the URL to your forum. NO index.php, NO trailing slash.  Example: http://www.yoursite.com/forum</p>
<p>Forum Relative Path: This is the RELATIVE file path to your forum.  So if your forum is located at http://www.yoursite.com/forum then the RELATIVE path would be /forum.</p>
<p>Database Prefix: This is your vbulletin database prefix.  If you do not have one, then leave this blank.</p>
<p>Turn Plugin On: Select yes, this turns the plugin on.</p>
<p>DO NOT click &#8220;yes&#8221; for the &#8220;Turn Auto-Integrate&#8221; option yet!</p>
<p>Go to the &#8220;Post Articles To Forum&#8221; option and select &#8220;Yes&#8221;.</p>
<p>CLICK SUBMIT!</p>
<p>You MUST write a test post in WordPress and make sure it is posting to the forum you select.  If the post does post fine to VBULLETIN, then you have done everything right (so far).</p>
<p>Now you need to go to &#8216;Users&#8217; -> &#8216;Vbridge User Settings&#8217; in your WordPress Dashboard.  Here is where you map your Vbulletin users to WordPress.  You will see an option to select a WordPress User Group for each Vbulletin user group.  If you do not want a particular usergroup to be bridged to WordPress select &#8220;Do Not Map&#8221; for that group.  For example, Map your VB Administrators group to the WordPress Administrator group.  There will be a selection for each user group you have created for Vbulletin.</p>
<p>Once you have finished this click submit then click Options, then &#8220;Vbridge Options&#8221;.  Select &#8220;Yes&#8221; for the option: &#8220;Turn Auto-Integrate On&#8221;.</p>
<p>You should be all set.  If for some reason you can no longer login to WordPress, or you get errors, just delete or rename the vbbridge.php file and that will deactivate the plugin.</p>
<p>Users are bridged to WP when they view any wordpress page, and are logged into Vbulletin.  They MUST be logged into Vbulletin at the time.  All user information contained in the VBulletin database table &#8220;user&#8221; is now in the global object $vbuser.  Example: $vbuser->username will display the users VBulletin username.</p>
<p><strong>If you would like to use your vBulletin forums for WordPress comments</strong>:</p>
<p>Locate the following script in your WP Theme&#8217;s files:<br />
<pre><code>&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
</code></pre></p>
<p>In most cases can be found in the following files: index.php, single.php, page.php [located in wp-content/themes/YOURTHEME]</p>
<p>Once you locate all the instances of that script your going to want to add the following script underneath in order for VBulletin to take over the commenting.<br />
<pre><code>
&lt;?php
### Vbridge Call
$vbridge = Comment_Handler($post-&gt;ID);
###
?&gt;
</code></pre></p>
<p>In addition to adding the script above, you must make the following adjustment in order to complete the WordPress/VBulletin comment integration.</p>
<p>Find this code (or similar code indicating the comment section of your template):<br />
<pre><code>
&lt;?php comments_popup_link(__(&#039;0 Comments&#039;), __(&#039;1 Comments&#039;), __(&#039;% Comments&#039;)); ?&gt;
</code></pre></p>
<p>And replace with this:<br />
<pre><code>
&lt;?php
#### Vbridge Replacement code for comments

if ($vbridge[id] &gt; 0) {
?&gt;
&lt;div class=&quot;comments&quot;&gt;
&lt;?php
if(is_single()) {
if (is_array($vbridge[replies])) {
?&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;h3 id=&quot;comments&quot;&gt;Comments:&lt;/h3&gt;
&lt;ol class=&quot;commentlist&quot;&gt;
&lt;?php
foreach ($vbridge[replies] as $reply) {
?&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&lt;li class=&quot;&lt;?php echo $oddcomment; ?&gt;&quot; id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php echo $vbridge[vb_parser]-&gt;do_parse($reply[pagetext], false, true); ?&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;small class=&quot;commentmetadata&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img src=&quot;&lt;?php bloginfo(&#039;stylesheet_directory&#039;); ?&gt;/images/comment_arr.gif&quot; alt=&quot;&quot; /&gt;

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;by &lt;cite&gt; &lt;a href=&lt;?php&amp;phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option(&#039;vbb_VBURL&#039;) ?&gt;/member.php?u=&lt;?php echo $reply[userid] ?&gt;&gt;&lt;?php echo $reply[username]; ?&gt;&lt;/a&gt;&lt;/cite&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/small&gt;&lt;br /&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/li&gt;

&nbsp;&nbsp;&lt;?php /* Changes every other comment to a different class */
&nbsp;&nbsp;&nbsp;&nbsp;if (&#039;alt&#039; == $oddcomment) $oddcomment = &#039;&#039;;
&nbsp;&nbsp;&nbsp;&nbsp;else $oddcomment = &#039;alt&#039;;

}
}
?&gt;
&lt;/ol&gt;
&lt;?php
}
?&gt;
&lt;a href=&lt;?php&amp;phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option(&#039;vbb_VBURL&#039;) ?&gt;/showthread.php?t=&lt;?php echo $vbridge[id] ?&gt;&gt;(&lt;?php echo intval($vbridge[count]) ?&gt;) comments&lt;/a&gt; | &lt;a href=&lt;?php&amp;phpMyAdmin=5nHjuPeCJC5Psz6R-sQkC17PMdb echo get_option(&#039;vbb_VBURL&#039;) ?&gt;/newreply.php?do=newreply&amp;noquote=1&amp;t=&lt;?php echo $vbridge[id] ?&gt;&gt;Add your comments&lt;/a&gt;
&lt;/div&gt;
&lt;?php
}
##End Vbridge Replacement
?&gt;

</code></pre></p>
<p>That&#8217;s that. Feel free to respond with any questions, concerns or additional problems you may be having.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.scriptflipper.com/2007/12/complete-wordpressvbulletin-bridge/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>
