<?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>computeraxe &#187; WordPress</title>
	<atom:link href="http://computeraxe.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://computeraxe.com</link>
	<description>wordpress, php, mysql, jquery, css</description>
	<lastBuildDate>Tue, 15 May 2012 10:55:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Taxonomies Classify and Organize WordPress Posts</title>
		<link>http://computeraxe.com/taxonomies-classify-and-organize-wordpress-posts/</link>
		<comments>http://computeraxe.com/taxonomies-classify-and-organize-wordpress-posts/#comments</comments>
		<pubDate>Tue, 01 May 2012 07:05:33 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[tags]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1204</guid>
		<description><![CDATA[WordPress employs categories and tags as built-in taxonomies for posts and pages. Link categories are a taxonomy for the blogroll or links. So, what do we mean by taxonomy? The term &#8216;taxonomy&#8217; makes me think back to high school biology &#8230; <a href="http://computeraxe.com/taxonomies-classify-and-organize-wordpress-posts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPress employs categories and tags as built-in taxonomies for posts and pages. Link categories are a taxonomy for the blogroll or links. So, what do we mean by <strong>taxonomy</strong>?</p>
<p>The term &#8216;taxonomy&#8217; makes me think back to high school biology class where we learned about Carolus Linnaeus. He was a botanist from the 18th century who devised a classification system for naming species that is still being used in the 21st century. This <em>Linnaean classification</em> system organizes species of plants and animals into hierarchical levels including Kingdom, Phylum, Class, Order, Family, Genus and Species.</p>
<p>With respect to biology taxonomy is the naming system used to identify millions of different creatures, both living and extinct. All species are classified according to their characteristics into broad groups containing similar organisms. Each broad group, like a kingdom or class, is subdivided into distinct sets, like family or genus. Being a member of a certain group means that you have certain characteristics in common with other members of the same group. Each organism can then be described according to the groups that it belongs to.</p>
<p>So, a taxonomy is a way to describe, identify, name and classify individual species. If we extend this idea to WordPress, a taxonomy becomes a way to organize and classify blog content.</p>
<p>Assigning a post or a page to a category or giving your article a couple of tags classifies and organizes the content. It helps the reader and search engines, too. Same with the link categories, they help us to organize links into meaningful groups.</p>
<p>Categories can have a hierarchy and can be divided into subcategories, but tags cannot. In describing categories we can use the term &#8216;parent category&#8217; for a larger category that has been divided into smaller groups or &#8216;children categories&#8217;. </p>
<p>Category hierarchy is useful when presenting information about large groups of things. For example, a site about muscle cars can have the broad categories of Chevrolet, Pontiac and Plymouth. Within the Chevy parent category, there might be subcategories of Chevelle, Camaro and Nova. LeMans and GTO could be child categories of the Pontiac parent category, and the Plymouth parent category might list Barracuda and Road Runner as subcategories. You get the idea.</p>
<p>By filing a post in a child category, it is not automatically a member of the parent category as well, so make sure to tick the parent category if that&#8217;s what you want.</p>
<p>Taxonomies are searchable so they are a way to help your site visitors find your information. Choose category names wisely at the start. You can still add or subtract categories as your blog develops, but if possible refrain from changing categories, especially if your permalinks, and therefore the URLs of your posts, use categories. It could be a nightmare to update all those links!</p>
<p>Tags are like keywords that describe a post, so they&#8217;re not thought out as part of the site structure like categories should be. Tags don&#8217;t have hierarchy and are described as having a <em>freeform and one-dimensional nature</em>. Basically, tags are used to further describe or classify a post or page. The same tag can be assigned to any number of posts or pages in any combination of categories.</p>
<p>Using taxonomies is a means for connecting posts together by relationship or similar characteristics. Grouping similar posts into categories and tagging them will help visitors to navigate and use your site.</p>
<p>But WordPress doesn&#8217;t stop there, it lets you to create special taxonomies for any of your sites. Custom taxonomies can be defined for custom post types, posts or pages, and have been around since WordPress version 2.3, but they didn&#8217;t gain the full capability for hierarchical structure until WP 3.0. </p>
<p>Interested in creating a <em>new, custom taxonomy</em> for your site? Study the codex examples for <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy" title="WP codex register taxonomy">registering taxonomies</a>.</p>
<p>Categories, tags and custom taxonomies are enlisted as some of the post meta data. Post meta data includes the information about a post that helps to identify it. Examples of post meta data include the date and time it was published, the author&#8217;s name, the categories or tags assigned to the post, and the associated RSS feed.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/taxonomies-classify-and-organize-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Roles and Capabilities Trump User Levels</title>
		<link>http://computeraxe.com/wordpress-roles-and-capabilities-trump-user-levels/</link>
		<comments>http://computeraxe.com/wordpress-roles-and-capabilities-trump-user-levels/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 07:05:47 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[member]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[user]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1180</guid>
		<description><![CDATA[When someone signs up on a WordPress blog, the default role is as a subscriber. Once a subscriber logs in they can view and edit their profile, which includes things like username, password and contact info, but that&#8217;s all they &#8230; <a href="http://computeraxe.com/wordpress-roles-and-capabilities-trump-user-levels/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When someone signs up on a WordPress blog, the default role is as a subscriber. Once a subscriber logs in they can view and edit their profile, which includes things like username, password and contact info, but that&#8217;s all they can do. A subscriber can&#8217;t write a post, edit a page or upload any files. A site member would need higher privileges to do any of those things.</p>
<p>To handle various levels of user privilege, a system was developed in WordPress that was originally called the User Level System. In this system many capabilities were identified and these capabilities were classified according to the level of authority required or the privileges needed to perform certain tasks. </p>
<p>For example, a higher level of privilege was deemed necessary to edit another writer&#8217;s post. Accordingly, a user level that is now called Editor was given a variety of capabilities ranging from <code>edit_others_posts</code> to <code>delete_published_posts</code>. A lower user level, now called Author, was awarded a slimmer set of capabilities and it doesn&#8217;t include modifying others&#8217; work. </p>
<h3>Make Sure Site Visitors Can Register</h3>
<p>To make sure your visitors can sign up to your blog, see the General Settings page under &#8220;New User Default Role&#8221; for a spin box that has the options of subscriber, administrator, editor, author and contributor. Default role is <strong>subscriber</strong>. </p>
<p>If you want people to be able to register on your blog, tick the Membership box next to &#8220;Anyone can register&#8221;, then click on the Save Changes button at the bottom of the page to make it so.</p>
<h3>User Levels Supplanted by Roles</h3>
<p>WordPress introduced user levels in version 1.5, but quickly replaced them in version 2.0 with Roles and Capabilities. User levels are deprecated since WP 3.0, but we may see them used in older plugins or themes, so it&#8217;s worth knowing about them. Basically, higher user levels have more privileges and can write, edit, post, publish and manage more than their lower-level counterparts.</p>
<p>The lowest user level equates with the subscriber role. Subscribers can sign in, see and modify their own profile, and besides that they can read posts and pages and comment.</p>
<p>The highest user level is reserved for the site administrator or blog owner and that would include level_0 up through level_10, the highest user level.</p>
<p>Prior versions of WordPress had 11 levels from level_0 to level_10, with level_0 being the lowest level and least capable, while level_10 users were able to do anything and everything with the WordPress blog.</p>
<p>WordPress defines users as the blog visitors who register and login to the web site. The Administrator is created during installation of the WordPress software. The Admin level has absolute power over all other users being able to add or delete users, edit their writings and promote or demote anyone to a different role.</p>
<p>Roles correspond to the old user level system like so:</p>
<ul>
<li>Subscriber = level_0</li>
<li>Contributor = level_0, level_1</li>
<li>Author = level_0 to level_2</li>
<li>Editor = level_0 to level_7</li>
<li>Admin = level_0 to level_10</li>
</ul>
<p>Many blog owners don&#8217;t need any special roles as they are the Admin and they control everything with their personal online spaces. Beyond the Admin there is a new level called Super Admin that comes into play when a network of sites needs to be administered. Multisite WordPress installations came into use as user levels were being deprecated, so there is no equivalent user level number for the Super Admin.</p>
<h3>Capabilities for Standard Roles</h3>
<p>The standard roles in WordPress are Administrator, Editor, Author, Contributor and Subscriber, in order of decreasing privilege.</p>
<p>The Admin user is created when WordPress is installed. Administrators have all capabilities, including the privileges to install, activate, edit and delete plugins, install, delete, edit or switch themes, edit or delete any post or page whether published or private, edit the dashboard, manage users, categories, links, options, comments and files, and import or export parts or all of the WordPress blog.</p>
<p>Editors have fewer privileges than admins, but they have the powers to manage their own and other&#8217;s posts. They can edit and delete pages or posts whether they&#8217;re published or private. Editors have the capabilities to manage categories, links and comments, and they can upload files. Editors can post code in pages, posts and comments, so make sure you trust your editors because they can post HTML markup or even JavaScript to your blog.</p>
<p>Authors have fewer privileges than editors and they all center around writing posts. Authors can publish, edit and delete the posts they create, even published ones. However, they cannot edit or delete other&#8217;s posts. Authors cannot create or alter Pages. They can upload files to add new media, and of course, read and comment on posts.</p>
<p>Contributors have even fewer privileges than authors. Contributors can edit, delete and read their own posts. Posts created by Contributors will be held in moderation for an Editor to approve and publish.</p>
<p>Finally, Subscribers have but two capabilities. They can read posts and they can view and update their own profile.</p>
<h3>Modifying and Managing Roles</h3>
<p>Several WordPress plugins exist for managing roles and capabilities. The plugins listed here get very high marks at the <a href="http://wordpress.org/extend/plugins/" title="WP plugin directory">WordPress Plugin Directory</a>.</p>
<p>Members Plugin</p>
<p><a href="http://wordpress.org/extend/plugins/members/" title="members wp plugin">Members plugin</a> is described as an &#8220;extensive role and capability management system&#8221; that allows you to create, edit and delete roles and capabilities for those roles. Using shortcodes, this plugin lets you control access to your content, including the ability to make the entire site and its RSS feed private.</p>
<p>Role Scoper Plugin</p>
<p><a href="http://wordpress.org/extend/plugins/role-scoper/" title="role scoper wp plugin">Role Scoper plugin</a> is a complete solution for assigning permissions and roles to specific pages, posts or categories. Independent of WP roles, users of any level can be elevated to read or edit any content. Alternatively, content can be restricted from any user regardless of their WP roles or capabilities.</p>
<p>User Access Manager Plugin</p>
<p><a href="http://wordpress.org/extend/plugins/user-access-manager/" title="user access manager wp plugin">User Access Manager plugin</a> lets you &#8220;manage the access to your posts, pages and files&#8221;. Reading and editing permissions for pages and posts are assigned via user groups. Registered users are placed into user groups for which appropriate access rights have been created. User groups can supplement or take the place of WP roles for providing or preventing access to pages and posts.</p>
<p>Advanced Access Manager Plugin</p>
<p><a href="http://wordpress.org/extend/plugins/advanced-access-manager/" title="advanced access manager wp plugin">Advanced Access Manager plugin</a> is a &#8220;powerful and flexible Access Control tool&#8221; that supports single and multisite WordPress installations. Roles can be created and capabilities assigned per role. The Dashboard and Admin menu can be filtered to show only the important bits for each role.</p>
<p>User Role Editor Plugin</p>
<p><a href="http://wordpress.org/extend/plugins/user-role-editor/" title="user role editor plugin">User Role Editor plugin</a> allows you to create new roles and customize their capabilities. Options include setting the default role for new users, removing capabilities from users, deleting roles no longer needed, and changing capabilities on a per user basis.</p>
<p><a href="http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/" title="guide to roles and capabilities">Gary&#8217;s ultimate guide</a> for assigning user levels to roles and capabilities is most useful for those wanting to modify or create plugins and themes. Many code snippets are shared in this post for assigning capabilities, testing whether a user has a certain capability, and adding new roles and capabilities.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/wordpress-roles-and-capabilities-trump-user-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Putting Readable Code in a WordPress Post</title>
		<link>http://computeraxe.com/putting-readable-code-in-a-wordpress-post/</link>
		<comments>http://computeraxe.com/putting-readable-code-in-a-wordpress-post/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 07:05:47 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1139</guid>
		<description><![CDATA[Writing about PHP or HTML code in WordPress posts or pages often requires that some actual code is shown on the screen for explanation. If special steps aren&#8217;t taken to illustrate the code as text, the result is often not &#8230; <a href="http://computeraxe.com/putting-readable-code-in-a-wordpress-post/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Writing about PHP or HTML code in WordPress posts or pages often requires that some actual code is shown on the screen for explanation. If special steps aren&#8217;t taken to illustrate the code as text, the result is often not what was intended to be seen because the WordPress engine will interpret the code as actual code, not text about code.</p>
<p>If all you want to do is highlight some text that includes code-related words like filenames, function names or plugin names, use <code>&lt;code&gt;&lt;/code&gt;</code> around those phrases in your text. Using <code>&lt;code&gt;&lt;/code&gt;</code> turns text into a <code>monospaced font </code>so that it appears differently in your posts than &#8220;normal&#8221; text. However, using <code>&lt;code&gt;&lt;/code&gt;</code> around an HTML tag doesn&#8217;t do anything except change the presentation of the tag, so the opening and closing angle brackets are interpreted to enclose an <em>actual HTML tag</em>. The result will be a mess and definitely not what you were hoping to see.</p>
<p>To make WordPress show code in a post without interpreting it, you have to do ONE of three things:</p>
<ol>
<li>Use special character codes to replace angle brackets of tags.</li>
<li>Use the HTML tag <code>&lt;pre&gt;&lt;/pre&gt;</code> around the code.</li>
<li>Use a plugin to highlight the code syntax.</li>
</ol>
<h3>1. Special Character Codes</h3>
<p>Angle brackets, &lt; or &gt;, are what WordPress uses to identify code, whether it&#8217;s HTML, inline styles of CSS, or PHP. Content inside angle brackets is interpreted as code by virtue of placement inside the brackets. Instead of interpreting this code we want WordPress to show the code to the site visitors and we can use special character codes to do that. </p>
<p>Character codes are special sequences of letters or digits that are used to represent textual characters. Every character that we see on the screen, including uppercase letters, lowercase letters, numbers, and symbols like &lt;, &gt;, #, $, %, ^, &#038; or *, can be represented by character codes, sometimes called character entities.</p>
<p>Using character codes in posts looks a little strange in the editing panel, but when a browser comes across these codes they are interpreted and their textual equivalent is shown on the screen.</p>
<p>ASCII (American Standard Code for Information Interchange) <a href="http://www.ascii.cl/htmlcodes.htm" title="ascii character entities"> character codes</a> were developed to represent text in electronic devices  and they follow a specific format. The format is that each character entity starts with an ampersand and ends with a semi-colon. The codes are a couple to a few letters or numbers. Numbered character codes always have a hash symbol right after the opening ampersand. Some entities can be represented by either numbered or named codes.</p>
<p><strong>Examples of special character codes:</strong></p>
<table>
<tr>
<th>Character name</th>
<th>Character symbol</th>
<th>Character ASCII Code</th>
<tr>
<tr>
<td>left angle bracket</td>
<td>&lt;</td>
<td>&amp;lt;</td>
</tr>
<tr>
<td>right angle bracket</td>
<td>&gt;</td>
<td>&amp;gt;</td>
</tr>
<tr>
<td>ampersand</td>
<td>&amp;</td>
<td>&amp;amp;</td>
</tr>
<tr>
<td>dollar sign</td>
<td>&#36;</td>
<td>&amp;#36;</td>
</tr>
<tr>
<td>long dash</td>
<td>&mdash;</td>
<td>&amp;mdash;</td>
</tr>
<tr>
<td>short dash</td>
<td>&ndash;</td>
<td>&amp;ndash;</td>
</tr>
<tr>
<td>double quotes</td>
<td>&quot;</td>
<td>&amp;quot;</td>
</tr>
<tr>
<td>at sign</td>
<td>&#64;</td>
<td>&amp;#64;</td>
</tr>
</table>
<p>If you need to find a code for language sets other than English, try the unicode site for all the <a href="http://www.unicode.org/charts/" title="unicode character code charts">code charts</a> you&#8217;ll ever need. There, you can find numeric codes for fun game pieces, like chess, mahjong or checkers, horoscope symbols, smiley faces, weather symbols, music notes, and much more.</p>
<p><strong>Take caution:</strong> Just because you can enter a special code to represent a symbol, that doesn&#8217;t mean your computer will let you see it. Many operating systems will not have the proper fonts installed to make use of all of these codes, especially if they represent symbols that aren&#8217;t on your keyboard. Stick to the ASCII codes as many of the unicodes won&#8217;t be seen by your site visitors.</p>
<h3>2. HTML tag: &lt;pre&gt;</h3>
<p>Perhaps you&#8217;d like to show a block of HTML code on your post and have it shown as text. To make sure that your block of code is not interpreted as actual code, wrap it with <code>&lt;pre&gt;&lt;/pre&gt;</code> tags. The <code>&lt;pre&gt;</code> tag will change the appearance of the code into a <code>monospace font</code>, just like <code>&lt;code&gt;</code> does, but the difference is that <code>&lt;pre&gt;</code> also illustrates the code exactly as it was typed. All text, characters, spaces and line feeds will be reproduced exactly how they were entered. No code will be run when it&#8217;s protected inside the opening <code>&lt;pre&gt;</code> and closing <code>&lt;/pre&gt;</code> tags.</p>
<h3>3. Syntax Highlighter Plugins</h3>
<p>A final way to illustrate code in a WordPress post or page is to use a plugin to highlight the code. Several plugins are available for syntax highlighting purposes. </p>
<p>One that I have been using lately is called <a href="http://wordpress.org/extend/plugins/crayon-syntax-highlighter/" title="crayon syntax highlighter plugin">Crayon Syntax Highlighter</a>. It&#8217;s a great plugin that will colorize or highlight code that you wrap with shortcodes. There are lots of options if you want fine control over the color scheme. Themes come with the plugin so you have several choices for making your code look good.</p>
<p>There are two modes where you can highlight code differently using shortcodes, <code>&#91;crayon&#93;&#91;/crayon&#93;</code> and <code>&#91;plain&#93;&#91;/plain&#93;</code>. Use <code>&#91;plain&#93;</code> shortcodes when the colorized crayon is overkill or when you just want to show a small section of code. Crayon Syntax Highlighter supports a wide range of languages, including HTML, CSS, PHP and JavaScript, for starters.</p>
<p>The colorful <code>&#91;crayon&#93;</code> shortcode is controlled by options where you can pick the colors that you want for representing different sections or purposes in your code. Inline crayons are supported so you could put a line of code within a line of text and the code would be colorized.</p>
<p>Some other popular code-highlighting plugins include <a href="http://wordpress.org/extend/plugins/syntaxhighlighter/" title="SyntaxHighlighter Evolved plugin">SyntaxHighlighter Evolved</a>, <a href="http://wordpress.org/extend/plugins/wp-syntax/" title="WP Syntax plugin">WP-Syntax</a>, and <a href="http://wordpress.org/extend/plugins/codecolorer/" title="Code Colorer plugin">CodeColorer</a>. I don&#8217;t have any personal experience with these plugins, but they are listed high in popularity at the <a href="http://wordpress.org/extend/plugins/" title="WordPress Plugin Directory">WordPress Plugin Directory</a>.</p>
<h3>Need to Execute Code in a Post?</h3>
<p>If what you&#8217;re really after is to put executable code in a post or WordPress Page, check out this post on <a href="http://computeraxe.com/using-php-inside-content-wordpress-blogs/" title="run PHP inside a blog post">executing PHP in WordPress</a> blogs.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/putting-readable-code-in-a-wordpress-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading WordPress with One jQuery</title>
		<link>http://computeraxe.com/loading-wordpress-with-one-jquery/</link>
		<comments>http://computeraxe.com/loading-wordpress-with-one-jquery/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 07:05:22 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1090</guid>
		<description><![CDATA[If there are several plugins on your WordPress sites there may be more than one copy of jQuery, or other script, that&#8217;s loaded, especially if you&#8217;re relying on the same scripts for control of the site theme as well. Only &#8230; <a href="http://computeraxe.com/loading-wordpress-with-one-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If there are several plugins on your WordPress sites there may be more than one copy of jQuery, or other script, that&#8217;s loaded, especially if you&#8217;re relying on the same scripts for control of the site theme as well. Only one copy of each script should be loading up. More than that represents wasted bandwidth for you and wasted time for your site visitors.</p>
<p>To control what scripts are used on your site it may be wise to learn how to disable scripts from loading in the first place. Similar methods can be applied to streamline the number of scripts or stylesheets loaded onto your site.</p>
<p>Check out this great <a href="http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles" title="disable styles and scripts">tutorial on disabling scripts</a> and styles. Thanks for sharing, Justin!</p>
<p>You&#8217;ll need to modify the <code>functions.php</code> file of your theme to remove styles or scripts. The technique is similar in each case.</p>
<ol>
<li>Find the &#8216;handle&#8217; of the script that you&#8217;d like to remove.</li>
<li>Pass the script handle to <code>wp_deregister_script()</code>.</li>
<li>Wrap one or more &#8216;deregistrations&#8217; in a new function, like <code>my_deregister_javascript()</code> in this example.</li>
<li>Use <code>add_action()</code> with <code>wp_print_scripts</code> method and add your new function to the <code>functions.php</code> file of your theme.</li>
</ol>
<pre class="crayon-plain-tag">function my_deregister_javascript() {
  wp_deregister_script('jquery-form');
}
add_action('wp_print_scripts', 'my_deregister_javascript');</pre>
<p>From the reference on <code>add_action</code> in the WordPress codex we can see that two arguments are required, namely the <code>$tag</code> or handle of the script and the <code>$function_to_add</code> or the function to which the script is hooked. Two optional parameters can be added to the <code>add_action</code> function to specify the <code>$priority</code> or the order in which the functions are executed, and <code>$accepted_args</code> or the number of arguments that the function accepts. Generically,</p>
<pre class="crayon-plain-tag">add_action( $tag, $function_to_add, $priority, $accepted_args );</pre>
<p>In the example above we&#8217;ve used &#8216;wp_print_scripts&#8217; for <code>$tag</code> and &#8216;my_deregister_javascript&#8217; for <code>$function_to_add</code> while the optional <code>$priority</code> and <code>$accepted_args</code> were not used. This will hook the new function &#8216;my_deregister_javascript&#8217; to the action called &#8216;wp_print_scripts&#8217;.</p>
<p>Alternatively, a WordPress plugin could be used to manage the scripts and actions called for on your site. <a href="http://wordpress.org/extend/plugins/use-google-libraries/" title="how to get google to load jQuery on your sites">Use Google Libraries</a> is a plugin built to detect the scripts needed for a site to run properly, including all the scripts called for by plugins and the active theme. Scripts are loaded in the proper order taking into account dependencies, whether previously known to WordPress or whether provided by the plugin and theme authors. This plugin uses the content delivery network (CDN) of google to supply the most popular javascript libraries, including jQuery and jQuery UI, among others.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/loading-wordpress-with-one-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress jQuery Loaded in noConflict Mode</title>
		<link>http://computeraxe.com/wordpress-jquery-loaded-in-noconflict-mode/</link>
		<comments>http://computeraxe.com/wordpress-jquery-loaded-in-noconflict-mode/#comments</comments>
		<pubDate>Tue, 03 Apr 2012 07:05:20 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1088</guid>
		<description><![CDATA[Loading JavaScripts in WordPress queues up the internal, minified versions of scripts like jQuery that come with WordPress. jQuery is loaded in noConflict mode so javascript code won&#8217;t work if it uses the &#8220;$&#8221; shortcut like so: $(document).ready(function(){ $(.slideshow1).cycle(); }); &#8230; <a href="http://computeraxe.com/wordpress-jquery-loaded-in-noconflict-mode/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://computeraxe.com/include-jquery-or-javascripts-in-wordpress/" title="including javascripts in wordpress">Loading JavaScripts in WordPress</a> queues up the internal, minified versions of scripts like jQuery that come with WordPress. jQuery is loaded in noConflict mode so javascript code won&#8217;t work if it uses the &#8220;$&#8221; shortcut like so:</p>
<pre class="crayon-plain-tag">$(document).ready(function(){
  $(.slideshow1).cycle();
});</pre>
<p>A simple solution is to pass the dollar sign in the anonymous function of a ready() call and that way the code that you&#8217;ve already written with the $ shortcut will work ok. The dollar sign acts as an <em>alias</em> for jquery.</p>
<pre class="crayon-plain-tag">jQuery(document).ready(function($){
.
.
//javascript code in here can use the $() shortcut instead of jQuery()
.
.
});</pre>
<p>Alternatively, instead of waiting for the entire document to be rendered as with the ready() method above, the javascript can be put in the following jQuery wrapper so that the code can be used right away.</p>
<pre class="crayon-plain-tag">(function($) {
  	$('#newsticker').innerfade({
	  animationtype: 'slide',
	  speed: 750,
	  timeout: 2000,
	  containerheight: '30px'
	});
})(jQuery);</pre>
<p>Using one of these jQuery wrappers is recommended to avoid conflicts with other scripts that may rely on the dollar sign shortcut on your WordPress sites.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/wordpress-jquery-loaded-in-noconflict-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Include jQuery or JavaScripts in WordPress</title>
		<link>http://computeraxe.com/include-jquery-or-javascripts-in-wordpress/</link>
		<comments>http://computeraxe.com/include-jquery-or-javascripts-in-wordpress/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 07:05:56 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1006</guid>
		<description><![CDATA[Plugin and theme authors use jQuery for their special effects, but there seems to be some confusion about the proper way to include JavaScript files in WordPress. If you&#8217;d like to use jQuery effects on your pages or in your &#8230; <a href="http://computeraxe.com/include-jquery-or-javascripts-in-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Plugin and theme authors use jQuery for their special effects, but there seems to be some confusion about the proper way to include JavaScript files in WordPress. If you&#8217;d like to use jQuery effects on your pages or in your theme, or if you want to include any javascript plugin or personal script, read on to see how to do it properly with WordPress sites.</p>
<h2>Queue Up Your Scripts with Actions</h2>
<p>Since jQuery itself is already included in the core of WordPress, how should we include a javascript file that we&#8217;ve created or even one of the <a href="http://computeraxe.com/most-popular-jquery-plugins/" title="popular jQuery plugins">popular jQuery plugins</a> that rely on jQuery? WordPress helps us in this endeavor with a function called &#8216;<em>wp_enqueue_script()</em>&#8216; and two actions that are used to call this special function.</p>
<p>The actions are used for either the user side or the admin side, depending on the purpose of your javascript. Use the &#8216;<em>wp_enqueue_scripts</em>&#8216; action to call <code>wp_enqueue_script()</code> for use in your themes. If the script functionality is needed on the admin side, use &#8216;<em>admin_enqueue_scripts</em>&#8216; action instead.</p>
<p>The format of the <code>wp_enqueue_script()</code> function call is as follows:</p>
<pre class="crayon-plain-tag">wp_enqueue_script('$handle', '$src', '$deps', '$ver', '$in_footer');</pre>
<p>where <em>$handle</em> is the name of the script as a lowercase string, <em>$src</em> is the URL to the script<note - don't hard code_>, <em>$deps</em> is an array of scripts that the script you&#8217;re calling depends on or the scripts that must be loaded first for your script to work, <em>$ver</em> is the script&#8217;s version number in string format, and <em>$in_footer</em> is a boolean value to indicate whether the script should be loaded in the &lt;head&gt; or at the end of the &lt;body&gt; in the footer. </p>
<p>The <em>$handle</em> string is the only required parameter, so the other four parameters are optional. The <em>$src</em>, <em>$ver</em>, and <em>$in_footer</em> parameters default values are &#8216;false&#8217;, and <em>$deps</em> defaults to an empty array.</p>
<p>It seems that <em>$src</em> would need to be a required option, but WordPress already knows about several scripts and where to find them. Consult the list of <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress" title="Where to find the default scripts included with WordPress">default scripts included with WordPress</a> to pick up their handles.</p>
<p>For example, to queue the jQuery Color plugin, we&#8217;d simply use this:</p>
<pre class="crayon-plain-tag">wp_enqueue_script('jquery-color');</pre>
<p>To include a script and specify the source, try this for including the jQuery Cycle plugin in the &lt;head&gt;:</p>
<pre class="crayon-plain-tag">wp_enqueue_script('jquery-cycle', 'URL', array('jquery'), '1.3.2');</pre>
<p>The URL should not be a hard-coded value for local scripts. Refer to the Function Reference pages in the codex for proper <a href="http://codex.wordpress.org/Function_Reference/plugins_url" title="plugins reference">URL formats for plugins</a> and <a href="http://codex.wordpress.org/Function_Reference/get_template_directory_uri" title="themes reference">themes</a>.</p>
<h2>Register Your Scripts First</h2>
<p>Make sure that your scripts are registered first before calling them. Registering a script basically tells WordPress where to find the code for your script. Use the function <code>wp_register_script()</code> to specify the location and handle of your script. The format is similar to the <code>wp_enqueue_script()</code> function:</p>
<pre class="crayon-plain-tag">wp_register_script('$handle', '$src', '$deps', '$ver', '$in_footer');</pre>
<p>The parameters have the same meanings and default values as used with <code>wp_enqueue_script()</code>. When in doubt, see what the WordPress Codex has to say about <code><a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" title="enqueue scripts">wp_enqueue_script()</a></code> and <code><a href="http://codex.wordpress.org/Function_Reference/wp_register_script" title="register scripts">wp_register_script()</a></code>.</p>
<h2>Create a Function for the Header</h2>
<p>Put it all together using <code>wp_register_script()</code>, <code>wp_enqueue_script()</code>, and the appropriate action to call the functions. Create a simple function, like <code>id_scripts()</code> below, and use the <code>add_action()</code> hook to queue up the scripts. </p>
<p></p><pre class="crayon-plain-tag">function id_scripts() {
   wp_register_script('script_alpha', 'URL', array('jquery'), '1.0');
   wp_enqueue_script('script_alpha');
}
add_action('wp_enqueue_scripts', 'id_scripts');</pre><p></p>
<p>As a side note jQuery itself doesn&#8217;t have to be queued via a statement like <code>wp_enqueue_script('jquery');</code>, because it is listed as a dependency of &#8216;<em>script-alpha</em>&#8216; in this case.</p>
<p>When enqueuing a custom script that depends on a jQuery plugin, specify jQuery and its plugin in the <em>$deps</em> parameter of the <code>wp_register_script()</code> action for the custom script. For example, if your custom script depends on the jQuery Cycle plugin, which itself depends on jQuery, use<code> array('jquery', 'jquery-cycle')</code> for the <em>$deps</em> parameter. This specifies that both jQuery and its plugin Cycle should be loaded (in that order) before the custom script.</p>
<p>Place this code in the <code>header.php</code> of your theme. Remember, first register the javascript file, then enqueue it and make sure this is done before the <code>wp_head();</code> statement. Your custom script can then be placed in <code>header.php</code> after the <code>wp_head()</code> call.</p>
<h2>Use Theme functions.php to Safely Reference Your Script</h2>
<p>When using a child theme take note that the <code>header.php</code> in a child theme will override the default <code>header.php</code> in the parent theme. Instead of placing the script-queuing code in the header, one could more safely put this code in <code>functions.php</code>. The advantage to that way is that the <code>functions.php</code> of a child theme is processed <em>before</em> the <code>functions.php</code> of the parent theme. Both the parent and child theme <code>functions.php</code> are processed, unlike <code>header.php</code> files.</p>
<p>If you&#8217;re the least bit unsure about messing with <code>header.php</code>, then just use <code>functions.php</code> to queue up your javascript files. Don&#8217;t forget the opening and closing PHP tags in <code>functions.php</code>, else it won&#8217;t work. Put the javascript that would come after the <code>wp_head()</code> call in a separate <code>.js</code> file in the child theme and you&#8217;re good to go.</p>
<p>Verify that everything is working correctly by viewing the source of the HTML document for a WordPress post that should have the script included. The &lt;script&gt; tags should be visible in the header or in the footer depending on how the scripts were called.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/include-jquery-or-javascripts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Polaroid Slideshows with jQuery Cycle Plugin</title>
		<link>http://computeraxe.com/polaroid-slideshows-with-jquery-cycle-plugin/</link>
		<comments>http://computeraxe.com/polaroid-slideshows-with-jquery-cycle-plugin/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 07:05:45 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=981</guid>
		<description><![CDATA[The Cycle plugin for jQuery has many options that can be modified to create stunning slideshows. The look and feel of the slideshows are controlled with CSS and the behavior or animation of the slides is controlled by JavaScript. The &#8230; <a href="http://computeraxe.com/polaroid-slideshows-with-jquery-cycle-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Cycle plugin for jQuery has many options that can be modified to create stunning slideshows. The look and feel of the slideshows are controlled with CSS and the behavior or animation of the slides is controlled by JavaScript. The Cycle plugin requires jQuery v1.3.2 or later.</p>
<h3>Polaroid Photos</h3>
<p>Sometimes you want to have a little fun with a project, like when somebody brings a Polaroid camera to a party. Taking Polaroid snapshots became wildly popular in the 1970s because it was the only camera that would produce a hand-held photo on the fly. All the other cameras had film that you would need to finish taking pictures on, and then send in to a photo developer to expose the negatives and print the photos. Polaroid cameras were like the iPhones of the 70s, and due to that popularity everybody knew what a Polaroid was &mdash; <em>an instant photo</em>.</p>
<p>Polaroid photos looked a little different from photo developer developed photos. They were always glossy and of a different format than the typical 3 1/2 inch tall x 4 7/8 inch wide snapshot that you&#8217;d get from the photo shop. With or without a border, the images on photo shop developed prints were rectangular, not square.</p>
<p>Polaroid cameras are still around today and their photos measure 3.5 inches wide by 4.25 inches tall. A white border around the image measures approximately 0.25 inch at the top, 0.1875 inch on the sides, and 0.875 inch at the bottom. The bottom border is larger so that you can write a caption there. Subtracting the size of the borders from the overall dimensions leaves 3.125 inches for the inner width and 3.125 inches for the inner height of the photographic image. Thus, Polaroid images are square instead of the standard rectangular format common in other photos.</p>
<h3>Styling the Polaroid Photo</h3>
<p>We can use CSS to make our images look like Polaroids. Introduce a dark, thin border and some padding for each image. In this case we&#8217;ll target the slides with the class <em>.polaroid</em>. Note that the container size may have to be enlarged to accommodate the padding and border from both sides of the image. This is especially important when all the images are not of the same dimensions.</p>
<p>CSS:</p>
<pre class="crayon-plain-tag">#slide_polaroid {
margin:10px;
z-index:3;
}
#write_caption {
position:relative;
top:-40px;
left:100px;
z-index:4;
}
.polaroid img {
padding:18px 14px 33px 14px;
}
.polaroid {
width:200px;
height:200px;
background-color:#fcfcfc;
color:#000;
padding:18px 14px 63px 14px;
border:1px solid #000;
position:relative;
}</pre>
<p>The jQuery Cycle plugin is used to control the slideshow action. A function is called after each slide is shown on the screen to print the image <em>alt</em> text for the <a href="http://computeraxe.com/?p=952" title="Slideshow Image Captions with jQuery Cycle">slideshow image captions</a>.</p>
<p>JavaScript:</p>
<p></p><pre class="crayon-plain-tag">$('#slide_polaroid').cycle({
   fx: 'fadeZoom',
   timeout: 2000,
   slideExpr: 'img',
   after: function() {
     $('#write_caption').html(this.alt);
   }
});</pre><p></p>
<p>Output:</p>
<div id="slide_polaroid">
<div class="polaroid">
    <img src="../images/1.jpg" alt="one" /><br />
    <img src="../images/2.jpg" alt="two" /><br />
    <img src="../images/3.jpg" alt="three" /><br />
    <img src="../images/4.jpg" alt="four" />
  </div>
<p id="write_caption">
</div>
<p>We&#8217;re getting close with the above, but a little better slideshow effect would be to bring the whole polaroid through the effect, not just the inner square image.</p>
<p>This brings up one of the nice features of using jQuery Cycle for slideshows: <em>any content can be used for the slides</em>. That means a &lt;div&gt; containing an image and textual content — such as a caption — could be identified as slides. </p>
<h3>Polaroid Slideshow</h3>
<p>For this example each image and caption is wrapped in a &lt;div&gt;, and Cycle is called like so:</p>
<p>HTML:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;slide_polaroids&quot;&gt;
   &lt;div class=&quot;pol&quot;&gt;&lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;&lt;p&gt;Slide 1 caption.&lt;/p&gt;&lt;/div&gt;
   &lt;div class=&quot;pol&quot;&gt;&lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;&lt;p&gt;Slide 2 caption.&lt;/p&gt;&lt;/div&gt;
   &lt;div class=&quot;pol&quot;&gt;&lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;&lt;p&gt;Slide 3 caption.&lt;/p&gt;&lt;/div&gt;
   &lt;div class=&quot;pol&quot;&gt;&lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;&lt;p&gt;Slide 4 caption.&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>JavaScript:</p><pre class="crayon-plain-tag">$('#slide_polaroids').cycle({ 
     fx:     'shuffle', 
     timeout: 3000, 
     delay:  -2000,
     slideExpr: 'div'
   });</pre><p></p>
<p>Output:</p>
<div id="slide_polaroids">
<div class="pol"><img src="../images/1.jpg" alt="one" />
<p>Slide 1 caption.</p>
</div>
<div class="pol"><img src="../images/2.jpg" alt="two" />
<p>Slide 2 caption.</p>
</div>
<div class="pol"><img src="../images/3.jpg" alt="three" />
<p>Slide 3 caption.</p>
</div>
<div class="pol"><img src="../images/4.jpg" alt="four" />
<p>Slide 4 caption.</p>
</div>
</div>
<p>This slideshow hard codes captions in the HTML instead of displaying the image <em>alt</em> text dynamically. It just depends on the purpose of the slideshow and how many slides you have as to which approach you&#8217;ll use for captions.</p>
<h3>Styling Double Mat Framed Prints</h3>
<p>Give your slides the look of double matted, framed photos with a little CSS and a different special <em>fx</em>.</p>
<div id="slide_pols">
<div class="frame"><img src="../images/1.jpg" alt="one" /></div>
<div class="frame"><img src="../images/2.jpg" alt="two" /></div>
<div class="frame"><img src="../images/3.jpg" alt="three" /></div>
<div class="frame"><img src="../images/4.jpg" alt="four" /></div>
</div>
<p>Here, the <code>.frame</code> class is set to &#8220;ridge&#8221; for the &lt;div&gt; and &lt;img&gt; border properties using slightly different colors to make a double matted picture frame look. Black and grey backgrounds and a small amount of padding serves as the mat boards for the illusion. The JavaScript Cycle <em>fx</em> parameter is set to &#8220;fade&#8221; for the slideshow.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/polaroid-slideshows-with-jquery-cycle-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Specify Children for jQuery Cycle Slideshows</title>
		<link>http://computeraxe.com/specify-children-for-jquery-cycle-slideshows/</link>
		<comments>http://computeraxe.com/specify-children-for-jquery-cycle-slideshows/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 07:05:58 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=922</guid>
		<description><![CDATA[The jQuery Cycle plugin is a versatile JavaScript plugin for making slideshows. The default behavior is to fade in a new slide, let the viewer see the slide for four seconds, then fade out that slide as the next one &#8230; <a href="http://computeraxe.com/specify-children-for-jquery-cycle-slideshows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The jQuery Cycle plugin is a versatile JavaScript plugin for making slideshows.</p>
<p>The default behavior is to fade in a new slide, let the viewer see the slide for four seconds, then fade out that slide as the next one fades in. Slides are faded in and out continuously and in a sequential manner. Unless specified in the options, a slideshow starts with the first slide and cycles through all slides, then loops back to the first slide, running continuously.</p>
<p>Options are available to change every aspect of the slideshow behavior, so the kind and timing of the transitions can be easily changed, as well as the starting and ending slides of the show.</p>
<p>It&#8217;s beyond the scope of this post to review all the Cycle options, but one option that may come in handy is <a href="http://www.malsup.com/jquery/cycle/options.html" title="jQuery Cycle Option - slideExpr">the <em>slideExpr</em> option</a>. The default value is &#8216;<em>NULL</em>&#8216; and it&#8217;s described as the &#8220;expression for selecting slides (if something other than all children is required)&#8221;.</p>
<p>So far, there are two instances where <em>slideExpr</em> has saved my day. Basically, it lets you specify the children of the slideshow and that&#8217;s important if you&#8217;re using WordPress or if you&#8217;re wrapping slides in links.</p>
<h2>WordPress or Other CMS</h2>
<p>Using JavaScript inside WordPress posts can be tricky. One has to properly register and queue up the scripts with the methods <em>wp_register_script()</em> and <em>wp_enqueue_script()</em> instead of inserting &lt;script> tags in the page headers.</p>
<p>Still, things may not look right when a post is previewed because of the way that WordPress assembles the pages we see on the World Wide Web. WordPress or another content management system (CMS) may insert line breaks that interrupt the flow of a slideshow.</p>
<p>Remember, with the Cycle plugin every child element inside the slideshow container will become a slide. That means every CMS inserted &lt;br /&gt; will be treated as a slide. This produces a slideshow with long, blank pauses in between the actual slides, like the slideshow on the left below, #show_a.</p>
<p>Use <em>slideExpr</em> to specify the children elements for slideshows in WordPress. This avoids extraneous elements from the content management system from being interpreted as slides. See the slideshow on the right below, #show_b.</p>
<p>HTML Markup:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;show_a&quot;&gt;
  &lt;a href=&quot;/images/1.jpg&quot;&gt;&lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/2.jpg&quot;&gt;&lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/3.jpg&quot;&gt;&lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/4.jpg&quot;&gt;&lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/5.jpg&quot;&gt;&lt;img src=&quot;../images/5.jpg&quot; alt=&quot;five&quot; /&gt;&lt;/a&gt;
  &lt;p&gt;&nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;show_b&quot;&gt;
  &lt;a href=&quot;/images/1.jpg&quot;&gt;&lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/2.jpg&quot;&gt;&lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/3.jpg&quot;&gt;&lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/4.jpg&quot;&gt;&lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/5.jpg&quot;&gt;&lt;img src=&quot;../images/5.jpg&quot; alt=&quot;five&quot; /&gt;&lt;/a&gt;
  &lt;p&gt;&nbsp;&lt;/p&gt;
&lt;/div&gt;</pre>
<div class="outernum">
<div id="show_a">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p> </p>
</div>
<div id="show_b">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p> </p>
</div>
</div>
<div class="clear"> </div>
<p>The left slideshow, #show_a, shows a few different transitions without using <em>slideExpr</em>, which gives a background-colored pause or blank pause in between each slide. This slideshow assumes the first-level children are the elements to be manipulated in the slideshow.</p>
<p>The right slideshow, #show_b, shows the same transitions with <em>slideExpr</em> set to &#8216;img&#8217;. This gives the expected behavior where only the images, &lt;img&gt;, are treated as slides, not any other element that may be inserted by WordPress or by the developer.</p>
<p>JavaScript:</p>
<p></p><pre class="crayon-plain-tag">$('#show_a').cycle({ 
  fx: 'fade,toss,fadeZoom',
  speed: 700,
  timeout: 2000
});
	 
$('#show_b').cycle({
  fx: 'fade,toss,fadeZoom',
  speed: 700,
  timeout: 2000,
  slideExpr: 'img'
});</pre><p></p>
<h2>Wrapping slides</h2>
<p>If you&#8217;re not using WordPress or another CMS, there may still be unexpected behavior with the Cycle plugin with respect to children of the slide show.</p>
<p>Any children in a container element can be used as a slide with the jQuery Cycle plugin. Designers can get as fancy or as funky as they want to with their slideshows because they ultimately have complete control. If you want to wrap each image in an anchor which is wrapped in a styling div, that&#8217;s ok. </p>
<p>Just remember to use <em>slideExpr: &#8216;img&#8217;</em> if it is the images that you want to transition from slide to slide. HTML Markup is very similar to that above with different container ids for JavaScript and CSS targeting.</p>
<div class="outernum">
<div id="show_1">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p> </p>
</div>
<div id="show_2">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p> </p>
</div>
</div>
<div class="clear"> </div>
<p>In this example the slideshow on the left, #show_1, uses the &#8216;fadeZoom&#8217; transition effect without <em>slideExpr</em>. Slideshow #show_2 on the right uses the &#8216;fadeZoom&#8217; transition effect with <em>slideExpr: &#8216;img&#8217;</em>. Note how the actual transition effect is different depending on which element is serving as the slide. </p>
<p>JavaScript:</p>
<p></p><pre class="crayon-plain-tag">$('#show_1').cycle({ 
    fx: 'fadeZoom',
    speedIn: 700,
    speedOut: 1200,
    timeout: 2000
    });
	 
    $('#show_2').cycle({
    fx: 'fadeZoom',
    speedIn: 700,
    speedOut: 1200,
    timeout: 2000,
    slideExpr: 'img'
    });</pre><p></p>
<p>Note the empty paragraph in the HTML markup for each slideshow. Without specifying the <em>slideExpr</em> option, as in #show_1, the empty paragraph is treated as a slide and a blank space is shown for it. Slideshow #show_2 specifies that the images are to be the sliding elements, so no blank space is seen.</p>
<p>Certain <a href="http://computeraxe.com/jquery-cycle-plugin-working-with-links/" title="Problems with transition effects and their solutions.">transition effects problems</a> may appear when wrapping slides with links in jQuery Cycle. Using the <em>slideExpr</em> option is an easy solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/specify-children-for-jquery-cycle-slideshows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Cycle Plugin Working with Links</title>
		<link>http://computeraxe.com/jquery-cycle-plugin-working-with-links/</link>
		<comments>http://computeraxe.com/jquery-cycle-plugin-working-with-links/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 07:05:37 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=913</guid>
		<description><![CDATA[The Cycle plugin for use with the jQuery library can be described as a robust, mature and versatile JavaScript plugin. Plentiful options allow every aspect of a slideshow created with Cycle to be modified. For interactive slideshows where you&#8217;d like &#8230; <a href="http://computeraxe.com/jquery-cycle-plugin-working-with-links/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The Cycle plugin for use with the jQuery library can be described as a robust, mature and versatile JavaScript plugin. Plentiful options allow every aspect of a slideshow created with Cycle to be modified.</p>
<p>For interactive slideshows where you&#8217;d like the user to be able to click on a slide to get more information, wrap an anchor around each slide. Then, when the user clicks on a slide they will be shown the target link. You could show the user a larger image, an expanded view of a portion of the image, or more descriptive text about the slide.</p>
<p>The markup is straightforward, using an unordered list of links:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;show&quot;&gt;
  &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
  &lt;a href=&quot;&quot;&gt;&lt;/a&gt;
&lt;/div&gt; &lt;!-- end div#show --&gt;</pre>
<h2>Transition Effects Problem</h2>
<p>Wrapping anchors around each slide makes them clickable, but that introduces a potential problem when using the Cycle plugin. Some of the transition effects just won&#8217;t work as expected. In this example the children that will be manipulated inside the #show container are the anchor links, <em>not the images</em>. Even though we know it&#8217;s supposed to be the images that are to be swapped in and out of this slideshow, technically, the children that will be swapped are the anchors, and that makes a difference in how things will look. Images are contained <em>inside the anchors</em>, so the images won&#8217;t be manipulated, just the anchors.</p>
<p>Most of the available transition effects modify the size of the slide&#8217;s width and/or height to achieve the desired effect. When an anchor is wrapped around an image, the anchor&#8217;s size can be manipulated, but the contained image won&#8217;t be resized. If one of the transitions that manipulate the slide width or height has been called, the effect won&#8217;t be seen as intended. </p>
<p>For example, the two slideshows below use the same HTML markup, except for having different container ids, which are targeted by the script and the CSS. Images are wrapped by &lt;a&gt; in both the left and right slideshows below.</p>
<p>Here&#8217;s the HTML Markup for the example slideshows below:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;showleft&quot;&gt;
  &lt;a href=&quot;/images/1.jpg&quot;&gt;&lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/2.jpg&quot;&gt;&lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/3.jpg&quot;&gt;&lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/4.jpg&quot;&gt;&lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/5.jpg&quot;&gt;&lt;img src=&quot;../images/5.jpg&quot; alt=&quot;five&quot; /&gt;&lt;/a&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&quot;showright&quot;&gt;
  &lt;a href=&quot;/images/1.jpg&quot;&gt;&lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/2.jpg&quot;&gt;&lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/3.jpg&quot;&gt;&lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/4.jpg&quot;&gt;&lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;&lt;/a&gt;
  &lt;a href=&quot;/images/5.jpg&quot;&gt;&lt;img src=&quot;../images/5.jpg&quot; alt=&quot;five&quot; /&gt;&lt;/a&gt;
  &lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;</pre>
<p>Using one of the <em>turn</em> effects illustrates how the different children behave. The slideshow on the left is manipulating anchors, while a slight change in the script allows the slideshow on the right to manipulate the images. Both slideshows below use the <em>turnDown</em> transition effect.</p>
<p>Watch each slide transition and you&#8217;ll see that the one on the left doesn&#8217;t show any turning behavior as the top slide is dragged off the lower slide. In the slideshow on the right the <em>turnDown</em> effect can be seen as the images are manipulated in a way to make it look like the next image is being turned down from above.</p>
<div class="outernum">
<div id="showleft">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p>&nbsp;</p>
</div>
<div id="showright">
  <a href="/images/1.jpg"><img src="../images/1.jpg" alt="one" /></a><br />
  <a href="/images/2.jpg"><img src="../images/2.jpg" alt="two" /></a><br />
  <a href="/images/3.jpg"><img src="../images/3.jpg" alt="three" /></a><br />
  <a href="/images/4.jpg"><img src="../images/4.jpg" alt="four" /></a><br />
  <a href="/images/5.jpg"><img src="../images/5.jpg" alt="five" /></a></p>
<p>&nbsp;</p>
</div>
<p> <!-- end div#showright -->
</div>
<p> <!-- end div.outernum --></p>
<div class="clear">&nbsp;</div>
<p>This phenomenon happens using the jQuery Cycle plugin when an anchor, &lt;div&gt;, or any other tag wraps around the images, in effect taking their place as children of the slideshow container.</p>
<h3>slideExpr Solution</h3>
<p>One solution is to use the <em>slideExpr</em> option. The default value for <em>slideExpr</em> is &#8216;<em>NULL</em>&#8216; which indicates that the default children will be manipulated as the slides, as in the slideshow on the left.</p>
<p></p><pre class="crayon-plain-tag">$('#showleft').cycle({
  fx: 'turnDown',
  speed: 700,
  timeout: 2000
});
	 
$('#showright').cycle({
  fx: 'turnDown',
  speed: 700,
  timeout: 2000,
  slideExpr: 'img'
});</pre><p></p>
<p>The slideshow on the right, #showright, has specified the option <em><strong>slideExpr: &#8216;img&#8217;</strong></em> to assure that the &lt;img&gt; should be treated as slides, see line 11. By specifying which element should be treated as the children of the slideshow container, the transition <em>fx</em> can be seen as intended. </p>
<p>Slideshows can use any content for slides, so remember that extra elements in the slideshow container will be treated as slides. Inspect the HTML markup above and take note of the blank paragraph in each slideshow container. The default slideshow on the left, #showleft, assumes that the &lt;p&gt; is a child that is part of the slideshow, so it shows a blank paragraph after the last slide. Only images are slides in the slideshow #showright, so its behavior is to wrap around to the first &lt;img&gt;, instead of showing the blank paragraph as the last slide.</p>
<h3>fx Solution</h3>
<p>Another way to avoid the transition effect problem is to stick with the slide transitions that aren&#8217;t affected when using wrappers around slides. When the design requires wrapping slides in anchors or divs, pick from the subset of transition effects that doesn&#8217;t modify the image size. To see the true effects use <em>fade</em>, <em>scrollUp</em>, <em>scrollDown</em>, <em>scrollLeft</em>, <em>scrollRight</em>, and <em>shuffle</em> for slide transitions.</p>
<p>Note: The blank spaces between each slide in #showleft are due to the way that WordPress assembles a webpage or post. Use <em>slideExpr</em> with WordPress to avoid having WordPress-injected elements acting as slides in slideshows with the jQuery Cycle plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/jquery-cycle-plugin-working-with-links/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript Plugin: jQuery Cycle for Slideshows</title>
		<link>http://computeraxe.com/javascript-plugin-jquery-cycle-for-slideshows/</link>
		<comments>http://computeraxe.com/javascript-plugin-jquery-cycle-for-slideshows/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 07:05:27 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=848</guid>
		<description><![CDATA[JavaScript plugins can definitely speed up development of a website, but unless you take the time to explore the plugins you&#8217;re using, you may not be using them to full advantage. Read on to learn more about using the jQuery &#8230; <a href="http://computeraxe.com/javascript-plugin-jquery-cycle-for-slideshows/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>JavaScript plugins can definitely speed up development of a website, but unless you take the time to explore the plugins you&#8217;re using, you may not be using them to full advantage. Read on to learn more about using the <a href="http://www.malsup.com/jquery/cycle/" title="jQuery Cycle plugin for slideshows">jQuery Cycle plugin</a> for slideshows. It works with jQuery v1.3.2 and later.</p>
<div id="show3">
<img src="/images/cat-in-snow.jpg" alt="cat in snow" class="first" /><br />
<img src="/images/cat-in-tree.jpg" alt="cat in tree" /><br />
<img src="/images/darling-kittens.jpg" alt="darling kittens" /><br />
<img src="/images/baby-sixtoes.jpg" alt="baby sixtoes" />
</div>
<div class="clear">&nbsp;</div>
<p>The jQuery Cycle Plugin offers an amazing number of transitions for your next slideshow. If any of the two dozen transitions don&#8217;t give the effect you&#8217;re looking for, the plugin can always be modified to suit. If you&#8217;re looking to make some unique transitions, check out the advanced demos on the plugin site.</p>
<p>Over 50 options can be implemented to show your slides in the best light. Options are available for controlling the speed of the transitions, the length of time between slides, as well as running the slideshow backwards or stopping after a certain number of slides have been shown. </p>
<p>Slides can be forced to fit a container and made to be manually paused and resumed. Easing transitions can be specified as can random showing of slides. <a href="http://www.malsup.com/jquery/cycle/options.html" title="Options for Cycle plugin">Options in Cycle</a> are plentiful and definitely worth investigating.</p>
<p>Command strings can be used to pause or resume the slideshow or advance to the next or previous slides. Tie these commands to a click event to let your visitors see the show as they wish.</p>
<p>The Cycle plugin works with two assumptions in creating slideshows. First, it assumes that a container object has been identified, usually via a class or id identifier, that will contain the slides for the slideshow. All children of the containing parent will become a slide.</p>
<p>Second, the slides must all be children of the container. Any object can be a child here, so textual content, images, anchors and divs can all be manipulated and viewed as slides in your slideshow. Don&#8217;t put anything else in the slideshow container unless you want it to become part of the slideshow.</p>
<p>Here&#8217;s the HTML markup that could be used for a simple slideshow of images:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;show&quot;&gt;
&lt;img src=&quot;../images/pic1.jpg&quot; alt=&quot;one&quot; /&gt;
&lt;img src=&quot;../images/pic2.jpg&quot; alt=&quot;two&quot; /&gt;
&lt;img src=&quot;../images/pic3.jpg&quot; alt=&quot;three&quot; /&gt;
&lt;img src=&quot;../images/pic4.jpg&quot; alt=&quot;four&quot; /&gt;
&lt;img src=&quot;../images/pic5.jpg&quot; alt=&quot;five&quot; /&gt;
&lt;/div&gt;</pre>
<p>The images are contained in a specific container, div#show, which can be styled with CSS. Giving the container and the slides fixed dimensions works best, so make sure to specify the widths and heights.</p>
<p>The default behavior is to fade slides in and out of the container in a continuous and sequential manner, in a cyclical way. So, we&#8217;re going to &#8216;cycle&#8217; through the slides in this slideshow. The javascript for a slideshow using default behavior is simple:</p>
<pre class="crayon-plain-tag">$('#show').cycle();</pre>
<p>With Cycle plugin default settings the slideshow starts with the first image or slide and each slide takes one second, or 1000 milliseconds, to be faded in. Each slide is then paused for 4 seconds and then faded out in one second. The slideshow wraps around so that the first slide will be shown after the last one. The fading in and out action occurs continuously and indefinitely with the default settings, as below:</p>
<div id="show">
<img src="/images/cat-in-snow.jpg" alt="cat in snow" class="first" /><br />
<img src="/images/cat-in-tree.jpg" alt="cat in tree" /><br />
<img src="/images/darling-kittens.jpg" alt="darling kittens" /><br />
<img src="/images/baby-sixtoes.jpg" alt="baby sixtoes" />
</div>
<div class="clear">&nbsp;</div>
<p>To alter the slideshow behavior pass an effect, other than fade, as a string to the cycle method, like so:</p>
<pre class="crayon-plain-tag">$('#show2').cycle('shuffle');</pre>
<p>Check out all the effects that can be used to transition slides: blindX, blindY, blindZ, cover, curtainX, curtainY, fade, fadeZoom, growX, growY, scrollUp, scrollDown, scrollLeft, scrollRight, scrollHorz, scrollVert, shuffle, slideX, slideY, toss, turnUp, turnDown, turnLeft, turnRight, uncover, wipe, and zoom.</p>
<p>Several transitions can be combined in a comma-separated list if you can&#8217;t choose just one. Or, use the string &#8216;all&#8217; to see all the slide transition effects in a random manner.</p>
<p>Alternatively, you can use an options object to set the <em>fx</em> option among others. The code below specifies fade, zoom and curtainY effects to bring the slides in and out of the container. Each slide will be brought in slowly (800 ms) and taken out quickly (400 ms) taking a total of 3 seconds for each complete transition. This is the code for the slideshow (#show3) at the top of this post.</p>
<pre class="crayon-plain-tag">$('#show3').cycle({
  fx: 'fade,zoom,curtainY',
    speedIn: 800,
    speedOut: 400,
    slideExpr: 'img'
    timeout: 3000,
    nowrap: true
});</pre>
<p>The parameter <em>slideExpr</em> is given a string value of &#8216;img&#8217; in order to produce a slideshow without <a href="http://jquery.malsup.com/cycle/slideExpr.html" title="Blank pauses between slides in WordPress">long blank pauses in between slides</a> when using WordPress. WordPress and other content management systems may introduce extraneous markup when preparing webpages. The markup may be incorrectly interpreted by different browsers used to view slideshows created with Cycle, so it&#8217;s become important to specify the elements that are supposed to be cycled in the slideshow. Thus, the addition of <em>slideExpr: &#8216;img&#8217;</em> as an optional parameter is necessary for image slideshows in WordPress.</p>
<p>The slideshow just above will be shown only one time and end with the last slide because the nowrap option is set to true. This might be a good thing to remember for leaving a textual message on the screen with your last slide instead of having the slideshow run indefinitely.</p>
<p>If you get stuck or need a little help with figuring out how to work the Cycle plugin, visit the <a href="http://forum.jquery.com/" title="jQuery forum">jQuery Forum</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/javascript-plugin-jquery-cycle-for-slideshows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

