<?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</title>
	<atom:link href="http://computeraxe.com/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>Pause and Play Buttons for jQuery Slideshow</title>
		<link>http://computeraxe.com/pause-and-play-buttons-for-jquery-slideshow/</link>
		<comments>http://computeraxe.com/pause-and-play-buttons-for-jquery-slideshow/#comments</comments>
		<pubDate>Tue, 15 May 2012 07:05:07 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1252</guid>
		<description><![CDATA[Continuing our slideshow journey with jQuery Cycle plugin, we&#8217;d like to improve our slider by adding two more buttons. Last time we looked at creating a slideshow with previous and next buttons, but now we&#8217;d like to add buttons for &#8230; <a href="http://computeraxe.com/pause-and-play-buttons-for-jquery-slideshow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Continuing our slideshow journey with jQuery Cycle plugin, we&#8217;d like to improve our slider by adding two more buttons. Last time we looked at creating a <a href="http://computeraxe.com/previous-next-buttons-jquery-cycle-slideshow/" title="Next and previous buttons for Cycle slideshow.">slideshow with previous and next buttons</a>, but now we&#8217;d like to add buttons for pause and resume. It would be nice to allow site visitors to stop a slideshow with a pause button and resume the slideshow with a play button whenever they&#8217;re ready to continue.</p>
<p>If we keep the overall design the same, we just need to do two things to modify the slider. First, we need to upload the images for the pause and resume buttons and add a couple of lines to the HTML markup for positioning the buttons. We&#8217;ll fit the pause and play buttons in between the previous and next buttons. Each button will use an anchor tag, an id for CSS and script targeting, and a title for a user-friendly tooltip.</p>
<p><strong>HTML Markup for Slideshow Controls:</strong></p>
<pre class="crayon-plain-tag">&lt;div id=&quot;nav-buttons&quot;&gt;
  &lt;a id=&quot;prev2&quot; href=&quot;#&quot; title=&quot;previous slide&quot;&gt;&lt;img src=&quot;../images/previous.png&quot; alt=&quot;Previous&quot; /&gt;&lt;/a&gt;
  &lt;a id=&quot;pauseButton&quot; href=&quot;#&quot; title=&quot;pause slideshow&quot;&gt;&lt;img src=&quot;../images/pause.png&quot; alt=&quot;Pause&quot; /&gt;&lt;/a&gt;
  &lt;a id=&quot;resumeButton&quot; href=&quot;#&quot; title=&quot;resume slideshow&quot;&gt;&lt;img src=&quot;../images/play.png&quot; alt=&quot;Play&quot; /&gt;&lt;/a&gt;
  &lt;a id=&quot;next2&quot; href=&quot;#&quot; title=&quot;next slide&quot;&gt;&lt;img src=&quot;../images/next.png&quot; alt=&quot;Next&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;</pre>
<p>Second, we need to add a couple of lines to the script to manage the action when someone clicks either button. Here, we&#8217;re assigning Cycle&#8217;s pause or resume option to the click function of the selected <code>id</code>, in this case <code>#slide_aft</code>. Adding a &#8216;return false&#8217; line assures that the site visitor won&#8217;t be taken to another page when the buttons are clicked.</p>
<p><strong>jQuery script portion for pause and resume buttons:</strong></p>
<p></p><pre class="crayon-plain-tag">$('#pauseButton').click(function() {
	   $('#slide_aft').cycle('pause');
		 return false;
 });
 $('#resumeButton').click(function() {
	   $('#slide_aft').cycle('resume');
		 return false;
 });</pre><p></p>
<p>The above script portion was placed in the <code>document.ready function($)</code> so that the buttons are able to be used as soon as practical.</p>
<p>Here&#8217;s the full slideshow example with button controls for pause, resume or play, previous slide, and next slide.</p>
<div id="contain">
<div id="slide_aft">
    <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>
<div id="nav-buttons">
  <a id="prev2" href="#" title="previous slide"><img src="../images/previous.png" alt="Previous" /></a><br />
<a id="pauseButton" href="#" title="pause slideshow"><img src="../images/pause.png" alt="Pause" /></a><br />
  <a id="resumeButton" href="#" title="resume slideshow"><img src="../images/play.png" alt="Play" /></a><br />
  <a id="next2" href="#" title="next slide"><img src="../images/next.png" alt="Next" /></a>
</div>
<p><!-- end div#nav-buttons -->
</div>
<p>Now, that looks a little better. This slideshow looks more complete having the pause and play or resume buttons, as well as the prev and next buttons.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/pause-and-play-buttons-for-jquery-slideshow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Previous and Next Buttons in a jQuery Cycle Slideshow</title>
		<link>http://computeraxe.com/previous-next-buttons-jquery-cycle-slideshow/</link>
		<comments>http://computeraxe.com/previous-next-buttons-jquery-cycle-slideshow/#comments</comments>
		<pubDate>Tue, 08 May 2012 12:27:01 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[Cycle]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1230</guid>
		<description><![CDATA[A site visitor to computeraxe wanted to know how to incorporate previous and next buttons in their slideshow using jQuery Cycle plugin. It&#8217;s easy! Let&#8217;s see an example, ok? If you haven&#8217;t checked out the simplicity of the jQuery Cycle &#8230; <a href="http://computeraxe.com/previous-next-buttons-jquery-cycle-slideshow/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A site visitor to computeraxe wanted to know how to incorporate previous and next buttons in their slideshow using jQuery Cycle plugin. It&#8217;s easy! Let&#8217;s see an example, ok?</p>
<p>If you haven&#8217;t checked out the simplicity of the jQuery Cycle plugin, you should because there&#8217;s a whole lot you can do with it. It&#8217;s a very versatile plugin and quite popular, which speaks to its usefulness &mdash; and cool factor, too. Previous posts here covered the basics about the <a href="http://computeraxe.com/javascript-plugin-jquery-cycle-for-slideshows/" title="jQuery Cycle plugin for slideshows">Cycle Plugin</a>, how to <a href="http://computeraxe.com/polaroid-slideshows-with-jquery-cycle-plugin/" title="Polaroid slideshow with Cycle">make slides look like Polaroids</a>, using <a href="http://computeraxe.com/slideshow-image-captions-with-jquery-cycle/" title="Slideshow image captions with jQuery Cycle">image captions with Cycle</a>, and discussions about a <a href="http://computeraxe.com/jquery-cycle-plugin-working-with-links/" title="Problems with transition effects and their solutions.">transition effects problem</a> with certain <em>fx</em>.</p>
<p>Let&#8217;s get into the example for making previous and next buttons for a slider in jQuery using the Cycle plugin. </p>
<p>Before writing any code it would be a good idea to sketch out the design for the slideshow. The photos or slides will be held in a container <code>div</code> that can be targeted for CSS styling and javascript. Captions and their container paragraph would also be placed inside the container <code>div</code>. In this example we&#8217;ll do away with the captions for simplicity and place the previous and next buttons inside the container <code>div</code>.</p>
<p>It turns out that Cycle has two options for creating the functionality for going to the next photo or the previous slide in a sequence. These options are appropriately named &#8216;next&#8217; and &#8216;prev&#8217;. The values to give for each are the locations of the next and previous buttons. To specify each location, create an <code>id</code>. </p>
<p>Here, we&#8217;re using <em>#next2</em> for the next button and <em>#prev2</em> for the previous button. Since we&#8217;re having only one next/previous button set for this slideshow, an <code>id</code> for each makes sense. If you have more than one slider on a page, a <code>class</code> would be more appropriate. When somebody wants to see the previous slide they&#8217;ll click on the &#8216;previous button&#8217;, so the best HTML tag for the slideshow controls is an anchor with a href of &#8216;#&#8217;. We don&#8217;t want to leave the page when clicking the previous button, we just want to see the previous slide in the show.</p>
<p><strong>HTML Markup:</strong></p>
<pre class="crayon-plain-tag">&lt;div id=&quot;contain&quot;&gt;
&lt;p&gt;Slideshow example using jQuery Cycle plugin with previous and next buttons.&lt;/p&gt;
  &lt;div id=&quot;slide_afta&quot;&gt;
    &lt;img src=&quot;../images/1.jpg&quot; alt=&quot;one&quot; /&gt;
    &lt;img src=&quot;../images/2.jpg&quot; alt=&quot;two&quot; /&gt;
    &lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;
    &lt;img src=&quot;../images/4.jpg&quot; alt=&quot;four&quot; /&gt;
  &lt;/div&gt;
&lt;div id=&quot;nav-buttonsa&quot;&gt;
  &lt;a id=&quot;prev2&quot; href=&quot;#&quot; title=&quot;previous slide&quot;&gt;&lt;img src=../images/previous.png&quot; alt=&quot;Previous&quot; /&gt;&lt;/a&gt;
  &lt;a id=&quot;next2&quot; href=&quot;#&quot; title=&quot;next slide&quot;&gt;&lt;img src=&quot;../images/next.png&quot; alt=&quot;Next&quot; /&gt;&lt;/a&gt;
&lt;/div&gt;&lt;!-- end div#nav-buttons --&gt;
&lt;/div&gt;</pre>
<p>We&#8217;ll use a couple of small images to accommodate the previous and next slide functionality. One could use the words &#8216;prev&#8217; and &#8216;next&#8217; instead of images, if desired. In case a site visitor needs help, we&#8217;ve included a tooltip for each button by the way of a title for each anchor.</p>
<p>We want to hide all the images except the first image whenever the document is ready. Else, we&#8217;ll use the window load function for the slider action.</p>
<p><strong>jQuery:</strong></p>
<p></p><pre class="crayon-plain-tag">// jQuery Cycle options for slideshow with next/previous buttons

$(window).load(function() {
  $('#slide_afta').cycle({
     fx: 'fadeZoom',
     timeout: 2000,
     next: '#next2',
     prev: '#prev2',
     slideExpr: 'img'
   }); 	 
});

// hide all but the first image when document is ready

jQuery(document).ready(function($) {
  $('#slide_afta img:gt(0)').hide();
});</pre><p></p>
<p>Of course, there are many different ways to style your slideshow. Here&#8217;s our example Cycle slider with next and previous buttons.</p>
<div id="containa">
<p><em>Slideshow example using jQuery Cycle plugin with previous and next buttons.</em></p>
<div id="slide_afta">
    <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>
<div id="nav-buttonsa">
  <a id="prev2" href="#" title="previous slide"><img src="../images/previous.png" alt="Previous" /></a><br />
  <a id="next2" href="#" title="next slide"><img src="../images/next.png" alt="Next" /></a>
</div>
<p><!-- end div#nav-buttonsa -->
</div>
<h3>What if you want two sliders on the same page?</h3>
<p>The first thing to recognize is that more than one <code>id</code> with the same name won&#8217;t work on the same page, so parts of the document for the second slider with an <code>id</code> will have to be changed over to a <code>class</code> or a different <code>id</code> name. CSS will have to be updated to reflect the changes, as will the javascript.</p>
<p>However, using the same <code>class</code> names for the next and previous controls for two sliders on the same page will result in both sliders being controlled by the same set of control buttons. That&#8217;s probably not what you&#8217;d want, nor what your site visitors would expect. Rename the action buttons (prev, next) and the container for the slides to different <code>class</code> names in order to be able to control the second slideshow. Of course, a second Cycle script would be needed to target the new container for the second slideshow.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/previous-next-buttons-jquery-cycle-slideshow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<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>camelCase OK for jQuery</title>
		<link>http://computeraxe.com/camelcase-ok-for-jquery/</link>
		<comments>http://computeraxe.com/camelcase-ok-for-jquery/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 07:05:50 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[properties]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=1070</guid>
		<description><![CDATA[CamelCase refers to a method of combining words into compound words. Instead of using a hyphen to connect two words, camelCase removes the hyphen or space between the words and capitalizes the second word. jQuery doesn&#8217;t mind if you use &#8230; <a href="http://computeraxe.com/camelcase-ok-for-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>CamelCase refers to a method of combining words into compound words. Instead of using a hyphen to connect two words, camelCase removes the hyphen or space between the words and capitalizes the second word. </p>
<p>jQuery doesn&#8217;t mind if you use camelCase when specifying CSS properties, so &#8216;border-color&#8217; means the same as &#8216;borderColor&#8217;. </p>
<p>The hyphenated property name should always be used in CSS stylesheets, for example, <em>background-color</em>.</p>
<pre class="crayon-plain-tag">.photos
{
  background-color: #fff;
  color: #000;
}</pre>
<p>In jQuery either the hyphenated <em>background-color</em> or camelCase <em>backgroundColor</em> could be used.</p>
<pre class="crayon-plain-tag">$(document).ready(function() {
  $('#b1').animate({
    height: '+=100px',
    backgroundColor: '#eee',
    color:'#2133aa'
  }, 2000, 'linear');
});</pre>
<p><strong>Tips:</strong></p>
<ol>
<li>Single quote marks are needed if the hyphenated property is used, but the non-hyphenated camelCase doesn&#8217;t require single quotes around the property name. </li>
<li>The <em>values</em> for each property should be inside single quotes.</li>
</ol>
<p>Which case you&#8217;ll use comes down to personal preference. I like to type fewer quotes and hyphens, so I tend to use camelCase where ever possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/camelcase-ok-for-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slideshow Loading Problems Solved in jQuery Cycle</title>
		<link>http://computeraxe.com/slideshow-loading-problems-solved-in-jquery-cycle/</link>
		<comments>http://computeraxe.com/slideshow-loading-problems-solved-in-jquery-cycle/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 07:05:13 +0000</pubDate>
		<dc:creator>axe</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://computeraxe.com/?p=979</guid>
		<description><![CDATA[When it comes to JavaScript components that act on elements of the page, it is highly important to have those elements in place before the script tries to manipulate them, else things won&#8217;t work as intended. So, that begs the &#8230; <a href="http://computeraxe.com/slideshow-loading-problems-solved-in-jquery-cycle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When it comes to JavaScript components that act on elements of the page, it is highly important to have those elements in place before the script tries to manipulate them, else things won&#8217;t work as intended. So, that begs the question, &#8220;What&#8217;s the best way to have JavaScript run on my page?&#8221; In this example we&#8217;ll focus on handling javascript while making slideshows with the jQuery Cycle plugin.</p>
<p>At any rate we want our pages to be seen by the visitor right away. We know if it takes more than a couple of seconds for anything to appear on the screen, the visitor is likely to click away to another site. Remember, text appears quickly when it&#8217;s not part of a table. The whole table has to be ready before you&#8217;ll see the table, so don&#8217;t use tables for design purposes, especially nested tables. Save your tables for presenting data.</p>
<p>A problem with big pages having slideshows is that if the page is not ready when a script tries to manipulate things, the effects may be all wrong. For example, when a script calculates the center position for an image it may get the positioning wrong, especially if all the images in the slideshow are not of the same size.</p>
<p>So, how do we improve our slideshow for the masses? We need to tell the javascript <em>when </em>to do its magic. In this example we&#8217;ll use this approach:</p>
<ol>
<li>Perform initial actions with the <code>.ready()</code> method. Actions in this case are to hide images with the <code>.hide()</code> method until they are called for by the script.</li>
<li>Run the slideshow after the content has loaded with the <code>.load()</code> method.</li>
<li>Use a function to calculate the center for each image. </li>
<li>Apply the function with the <em>before</em> option in jQuery Cycle.</li>
</ol>
<p>A previous post on <a href="http://computeraxe.com/centering-slideshows-with-jquery-cycle-plugin/" title="jQuery cycle centers slideshows">centering slideshows with jQuery Cycle</a> put all the javascript inside a <code>.ready()</code> statement. For many scripts this would be just fine, but for the slideshow it resulted in the action starting up before all the images were available.</p>
<p>For this example the slideshow is marked up as a group of images inside a &lt;div&gt; that has been assigned an id for JS targeting, <code>#big_show</code>, and a class for CSS targeting, <code>.photos</code>.</p>
<p>HTML Markup:</p>
<pre class="crayon-plain-tag">&lt;div id=&quot;big_show&quot; class=&quot;photos&quot;&gt;
    &lt;img src=&quot;http://computeraxe.com/images/1.jpg&quot; alt=&quot;one&quot; /&gt;
    &lt;img src=&quot;http://computeraxe.com/images/2.jpg&quot; alt=&quot;two&quot; /&gt;
    &lt;img src=&quot;../images/3.jpg&quot; alt=&quot;three&quot; /&gt;
    &lt;img src=&quot;http://computeraxe.com/images/4.jpg&quot; alt=&quot;four&quot; /&gt;
  &lt;/div&gt;</pre>
<h2>Hide Images While Page Loads</h2>
<p>Because it may take a while to load up all the photos for the slideshow, and everything else on the page, hide the photos except for the first one to start. Use a <code>.ready()</code> statement to hide the photos because we want to do that right away. Put everything in the <code>.ready()</code> method that you want to run first, even before the rest of the page or content has loaded. The <code>.ready()</code> function is a jQuery construct that allows you to bring functionality to the page before all the content has loaded. That way a page with lot of images can be useful even before all the images are visible. </p>
<p>For hiding images use the <code>.ready()</code> function so that this task will occur as soon as possible.</p>
<p></p><pre class="crayon-plain-tag">$(document).ready(function() {
    $('#s1 img:gt(0)').hide(); // hides all images with index greater than 0, so it shows the first image only - in one JS/jQuery call

    $('#s2 img').hide(); // hides all images
    $('#s2 img:first').show(); // shows the first image

    $('#s3 img').hide(); // hides all images
    $('#s3 img:eq(0)').show(); // shows the image with index equal to 0
});</pre><p></p>
<p>Many selectors could be used to target the first element in a series and the example above shows three ways of doing so for three different slideshows, <em>#s1</em>, <em>#s2</em> and <em>#s3</em>. The outcome of each is the same in that only the first image is shown until the rest of the slideshow is loaded.</p>
<h2>Control Slideshow Action After Window Loads</h2>
<p>It makes sense to run a slideshow only when all the components for the show are present. To do that run Cycle with a <code>.load()</code> statement so that the slideshow waits to start until all of the images are loaded.</p>
<p></p><pre class="crayon-plain-tag">$(window).load(function() {
  $('#big_show').cycle({ 
    fx:     'fadeZoom', 
    timeout:  2000,
    before: onBefore
  });
});</pre><p></p>
<p>If you have a big slide show with lots of images, you might want to present an <a href="http://computeraxe.com/generate-animated-loading-images/" title="where to find animated loading images">animated loading image</a> until the slideshow starts.
<link>
<h2>Calculate Image Size for Centering in Slideshow</h2>
<p>Take a look at the solution provided by &#8220;malsup&#8221; for users of his Cycle plugin:</p>
<p></p><pre class="crayon-plain-tag">function onBefore(curr,next,opts) {
    var $slide = $(next);
    var w = $slide.outerWidth();
    var h = $slide.outerHeight();
    $slide.css({
        marginTop: (400 - h) / 2,
        marginLeft: (300 - w) / 2
    });
};</pre><p></p>
<p>Basically, what his code is doing is creating a function that will run before any slides are manipulated by Cycle. The purpose of the <em>onBefore</em> function is to calculate the correct margins for images and set the CSS parameters margin-top and margin-left for centering the images. </p>
<p>The <em>onBefore</em> function creates a variable called <em>$slide</em> to hold an array of the parameters of the <code>$(next)</code> element in the slideshow. The variables <em>w</em> and <em>h</em> are set to the width and height of said element via the <code>$slide.outerWidth()</code> and <code>$slide.outerHeight()</code> methods, respectively. </p>
<p>Finally, the margins are calculated from knowing the width and height of the slide container as set in the CSS (in this example 400 px and 300 px) and subtracting the slide&#8217;s width (<em>w</em>) and height (<em>h</em>) values, respectively. The margins only need to have half of the total margin value to accommodate both sides of the box, so the difference is divided by 2.</p>
<h2>Use Cycle&#8217;s <em>Before</em> Option to Apply Centering Function</h2>
<p>Using the <em>onBefore</em> function with Cycle&#8217;s <em>before</em> option works beautifully with images of different sizes, see line 5 of the <code>.load()</code> method above. Margins are set using the <code>.css()</code> method after they are calculated by the <em>onBefore</em> function.</p>
<p>CSS:</p>
<pre class="crayon-plain-tag">#big_show {
    height: 400px;
    width: 300px;
    text-align: center;
    background-color: #f3c;
}
.photos img {
    margin: 0;
    padding: 4px;
    border: 1px solid #ccc;
    background-color: #eee;
    max-width: 290px;
    max-height: 390px;
}</pre>
<p>You have to specify some CSS to get this thing to work right, namely <strong>set the width and height on the slide container and slides themselves</strong>.</p>
<p>Setting the <em>max-width</em> and <em>max-height</em> for the images helps to keep them inside of the container. Note that adding up the padding and border for both sides of the box is 10 px of the slideshow box that can&#8217;t be used to show an image. Therefore, the maximum image dimensions are the overall width or height minus 10 px. By accounting for the padding and border sizes a large image won&#8217;t overflow its container.</p>
<p>Any comments on this improved slideshow using Cycle plugin with jQuery?</p>
]]></content:encoded>
			<wfw:commentRss>http://computeraxe.com/slideshow-loading-problems-solved-in-jquery-cycle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

