<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>MAJ Web Development » Web pro stuff</title>
	
	<link>http://majweb.co.uk</link>
	<description>Good with computers and humans alike!</description>
	<lastBuildDate>Tue, 28 May 2013 13:23:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/MajWebDevelopmentWebProStuff" /><feedburner:info uri="majwebdevelopmentwebprostuff" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Updating attachments guid in the WordPress database</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/-J1EXEclw5g/</link>
		<comments>http://majweb.co.uk/updating-attachments-guid-in-the-wordpress-database/#comments</comments>
		<pubDate>Thu, 21 Feb 2013 11:25:45 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[Wordpress development]]></category>
		<category><![CDATA[attachment post type]]></category>
		<category><![CDATA[images in wordpress]]></category>
		<category><![CDATA[wordpress database]]></category>

		<guid isPermaLink="false">http://majweb.co.uk/?p=1360</guid>
		<description><![CDATA[This is something that happens when it&#8217;s time to move from development to production with a WordPress website, or more generally when you change the domain name of a WordPress website. The path of attachments &#8211; pictures, media, documents &#8211; which is also their guid, should change accordingly. Otherwise, if in some places your theme <a class="readMore" href="http://majweb.co.uk/updating-attachments-guid-in-the-wordpress-database/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p>This is something that happens when it&#8217;s time to move from development to production with a WordPress website, or more generally when you change the domain name of a WordPress website. The path of attachments &#8211; pictures, media, documents &#8211; which is also their guid, should change accordingly. Otherwise, if in some places your theme displays post attachments by referring to their guid, the path will be wrong and, in the case of pictures for example, these will not be displayed if they were originally on a localhost or if, say, you get rid of site on the old domain altogether.</p>
<p>Hopefully there is a one minute formula to avoid this: a one line SQL statement that will update all guids of attachments in one go, directly in the WordPress database.</p>
<h3>The procedure</h3>
<p>Access your new WordPress database via phpMyAdmin.</p>
<p>Click the &#8216;SQL&#8217; tab &#8211; framed in red in the picture below.</p>
<div id="attachment_1361" class="wp-caption alignnone" style="width: 610px"><img class="size-full wp-image-1361" alt="SQL tab in phpMyAdmin" src="http://majweb.co.uk/wp-content/uploads/2013/02/phpmyadmin.png" width="600" height="102" /><p class="wp-caption-text">SQL tab in phpMyAdmin</p></div>
<p>In the &#8216;Run SQL query/queries on database <em>nameofdatabase</em>&#8216; field, enter the following query:</p>
<pre>UPDATE `<em>pre_</em>posts` SET `guid` =  REPLACE( `guid` , '<em>http://old-url-to-wordpress</em>' , '<em>http://new-url-to-wordpress</em>' ) WHERE `post_type` = 'attachment'</pre>
<p><em><strong>pre_</strong> </em>is your table prefix (the default being &#8216;wp_&#8217;)</p>
<p><strong><em>http://old-url-to-wordpress </em></strong>is the previous url to the WordPress directory (not to mix up with the home url!)</p>
<p>Similarly,<strong><em> http://new-url-to-wordpress </em></strong>is the new url to the WordPress directory.</p>
<p>And this should do the trick!</p>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/-J1EXEclw5g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/updating-attachments-guid-in-the-wordpress-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/updating-attachments-guid-in-the-wordpress-database/</feedburner:origLink></item>
		<item>
		<title>5 tips to make the WordPress admin easy on your customers</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/wW17QrhKRao/</link>
		<comments>http://majweb.co.uk/5-tips-to-make-the-wordpress-admin-easy-for-your-customers/#comments</comments>
		<pubDate>Fri, 28 Sep 2012 03:08:08 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[Wordpress development]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[wordpress admin]]></category>

		<guid isPermaLink="false">http://majweb.co.uk/?p=1073</guid>
		<description><![CDATA[You&#8217;re a WordPress whizz? Great. But how are your customers faring when they face the WordPress dashboard? Simplifying the WordPress admin to improve its usability can make your customers very happy (and therefore more likely to recommend your services) and can greatly reduce the need for unanticipated customer support following projects! Here are 5 things to <a class="readMore" href="http://majweb.co.uk/5-tips-to-make-the-wordpress-admin-easy-for-your-customers/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p>You&#8217;re a WordPress whizz? Great. But how are your customers faring when they face the WordPress dashboard?</p>
<p>Simplifying the WordPress admin to improve its usability can make your customers very happy (and therefore more likely to recommend your services) and can greatly reduce the need for unanticipated customer support following projects!</p>
<p>Here are 5 things to consider to make the WordPress dashboard simpler.</p>
<h3>1. Remove those dashboard widgets</h3>
<p>You know, all these boxes of &#8216;stuff&#8217; that try to assail your attention when you land in the admin&#8230;Just get rid of them for you client. That way, the first time they log in, their attention is channelled towards the only useful thing on that page: the menu.</p>
<p>It&#8217;s a matter of seconds: <strong>click on the &#8216;Screen Options&#8217; tab at the top of the screen and uncheck all the boxes</strong>.</p>
<h3>2. Hide unnecessary menu items</h3>
<p>Create a &#8216;webmaster&#8217; or &#8216;tech &#8216; account providing access to a full admin menu, and an account with a simplified menu for the customer. As a rule of thumb, you can get rid of the &#8216;Links&#8217; and &#8216;Tools&#8217; sections. Remove &#8216;Posts&#8217; if he/she doesn&#8217;t intend to blog. In some cases, the essentials boil down to just &#8216;Posts&#8217;, &#8216;Pages&#8217;, &#8216;Comments&#8217; and &#8216;Media&#8217;, most of all if all the rest can be found in a webmaster account.</p>
<p>Here is how you can remove admin menu items. <strong>Place the following code in you theme&#8217;s <em>functions.php</em> file or in one of your plugin files.</strong></p>
<pre><code>add_action( 'admin_init' , 'simplify_menu' , 999 );</code>

<code>function simplify_menu(){ </code>
<code> remove_menu_page('link-manager.php');</code>
<code> remove_menu_page('tools.php');</code>
<code>} </code></pre>
<pre><code>
</code></pre>
<p>This particular example removes the &#8216;Links&#8217; and &#8216;Tools&#8217; sections for all users. Build an appropriate conditional statement to remove sections for particular users only, e.g. to remove these links for the user with id number 5 only:</p>
<pre><code>add_action( 'admin_init', 'simplify_menu' , 999 );</code>

<code>function simplify_menu() {</code>
<code>  $current_user = wp_get_current_user();</code>
<code>  if( $current_user-&gt;ID == 5 ){</code>
<code>      remove_menu_page('link-manager.php');</code></pre>
<p><code>      remove_menu_page('tools.php');</code><br />
<code>  }</code><br />
<code>}</code></p>
<h3>3. Turn off unnecessary custom post types</h3>
<p>When would you want to do this? In the situation where the customer wants you to work with a theme they purchased, and said theme generates a series of custom post types, e.g. &#8216;portfolio items&#8217;, that you know are not relevant to the project.</p>
<p>You create a child theme to bring changes to the purchased theme. To remove the unnecessary post types,<strong> place this code in the <em>functions.php</em> file of the child theme:</strong></p>
<pre><code>add_action( 'after_setup_theme','remove_project_custom_init', 100 );</code></pre>
<pre><code>function remove_project_custom_init() { </code></pre>
<pre><code> remove_action('init', 'custom_post_type_1');</code></pre>
<pre><code> remove_action('init', 'custom_post_type_2');</code></pre>
<pre><code>}</code></pre>
<p>in which <em>custom_post_type_x </em>is the name of the function in which the custom post type is registered in the original theme.</p>
<h3>4. Use and abuse of the Advanced Custom Fields plugin</h3>
<p>The advanced custom fields plugin - <a href="http://www.advancedcustomfields.com/" target="_blank">http://www.advancedcustomfields.com/</a> - allows you to add content fields to posts. You can add these fields to all posts or select a particular subset of posts, pages etc. I strongly recommend to try it and most of all to purchase the repeater field addon.</p>
<p>To give you an example, I often use <a href="http://www.advancedcustomfields.com/" target="_blank">ACF</a> for testimonial pages. Instead of expecting the website user to format the quotes and signatures themselves in TinyMCE, a testimonials meta box is provided. Adding a testimonial then consists in pressing a button and filling a &#8216;quote&#8217;, &#8216;client name&#8217;,  &#8217;client website&#8217;, and &#8216;client website url&#8217; form. Like so:</p>
<p><a href="http://majweb.co.uk/wp-content/uploads/2012/09/acf.png"><img class="size-large wp-image-1102 aligncenter" title="Testimonial form" src="http://majweb.co.uk/wp-content/uploads/2012/09/acf-600x369.png" alt="Testimonial form" width="600" height="369" /></a></p>
<p>The formatting of the testimonials is automated in the theme. The alternative would be to create a custom post type for testimonials, but it just seems more intuitive to look for a particular page&#8217;s content in a corresponding page in the dashboard.</p>
<h3>5. Use scripts already included with WordPress</h3>
<p>If you are creating your own theme or plugin option pages, think of re-using features already used somewhere else in the admin. I am thinking of the <a href="http://acko.net/blog/farbtastic-jquery-color-picker-plug-in/" target="_blank">Farbtastic colour picker</a> or the <a href="http://wp.tutsplus.com/tutorials/creative-coding/how-to-integrate-the-wordpress-media-uploader-in-theme-and-plugin-options/" target="_blank">ThickBox media uploader</a> for example. Admin users already know how to use them and it looks more consistent and professional.</p>
<p>You can find a list of the scripts already available in the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress" target="_blank">WordPress Codex <em>wp_enqueue_script </em>function reference page</a>.</p>
<p>&nbsp;</p>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/wW17QrhKRao" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/5-tips-to-make-the-wordpress-admin-easy-for-your-customers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/5-tips-to-make-the-wordpress-admin-easy-for-your-customers/</feedburner:origLink></item>
		<item>
		<title>5 tips to avoid being put under pressure</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/5HZqDZ6xOFA/</link>
		<comments>http://majweb.co.uk/5-tips-to-avoid-being-put-under-pressure/#comments</comments>
		<pubDate>Tue, 28 Aug 2012 06:03:07 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[Freelancing]]></category>
		<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[client management]]></category>
		<category><![CDATA[stress]]></category>

		<guid isPermaLink="false">http://majweb.co.uk/?p=1037</guid>
		<description><![CDATA[Web development and programming are best performed by cool-headed Zen masters. To be productive, it&#8217;s often best to pace yourself and sleep on problems. That&#8217;s what is said in the world of textbooks. Then comes the reality check: clients want their site built for yesterday, are constrained by budget and the web developer that you <a class="readMore" href="http://majweb.co.uk/5-tips-to-avoid-being-put-under-pressure/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p>Web development and programming are best performed by cool-headed Zen masters. To be productive, it&#8217;s often best to pace yourself and sleep on problems. That&#8217;s what is said in the world of textbooks. Then comes the reality check: clients want their site built for yesterday, are constrained by budget and the web developer that you are, sitting at the last post on the line of the website production, ends up squeezed against the launch deadline.</p>
<p>Let&#8217;s deal with this problem as cool-headed Zen masters. Moaning about it on forums is not going to improve the situation. Educating clients <em>en masse</em> is simply unfeasible. So here are a few tips that I use to avoid the pressure and still keep clients and design partners happy.</p>
<h2>1. Phone and emails OFF for most of the day</h2>
<p>With the exception of days of website launches, or prior arrangements with clients, I check my emails and voice mail twice a day: once in the morning, and once at the end of the day. The rest of my day is made of solid, distraction-free programming time. No-one so far has complained.</p>
<h2>2. Assign more time than you need for all tasks</h2>
<p>We all know web projects generally take more time than anticipated. On top of that, as freelancers, we never can work full time on anything: there are quotes to write, emails to send, admin to do&#8230; So simply assign more time than needed for your web projects and inform clients and partners of that deadline. You will sometimes (yet less often than you&#8217;d think!) end up delivering &#8216;in advance&#8217;, thereby making everyone happy.</p>
<p>How much extra time to add really depends on the type of project and how confident you are with the task at hand (is it routine or something new for you?) For example, WordPress themes usually take me 2-3 days to code, but I always give a 5 working day deadline to clients.</p>
<h2>3. Spell out your requirements to finish the job on time</h2>
<p>A common scenario in web project is this. The design is kind of finished but maybe there&#8217;s one last thing for which the designer is still waiting for feedback e.g. one or two illustrations, and the client is still working on the copy. But the client is keen to have his/her website and asks if you can get started with what you have.</p>
<p>Well&#8230; it depends. Usually I don&#8217;t mind (mostly because I require a substantial upfront that has the virtue of increasing my patience when things are hanging in the air mid-project). But, I make it clear that I cannot completely finish the website by the agreed deadline if I don&#8217;t receive all the material X days prior to that deadline. I remain flexible, yet sensible and clients appreciate that.</p>
<h2>4. Cut down on waffling and manipulative channels</h2>
<p>Meetings and conference calls are good for two things: seeing how you get on with the client and reaching several people in one go. Full stop!</p>
<p>Phone/Skype calls are good for one thing: <strong>clarifying</strong> instructions and briefs. Full stop!</p>
<p>For any other reason, email is the appropriate medium. It keeps a trace of every transaction, you can refer to it as many times as you like and, last but not least, it forces the sender to spell things out in a structured way&#8230; which phone doesn&#8217;t do. What am I getting at? Beware of that client that systematically tries to get you on the phone. Usually, they are wafflers; at worst, they count on emotional factors to pressure you &#8211; because it&#8217;s not easy <strong>saying</strong> &#8217;no&#8217;.</p>
<p>Also beware of voice mails telling you to call back asap because &#8216;it is urgent&#8217;. In 90% of the cases, &#8216;urgent&#8217; can be replaced by &#8216;I sat on it until last minute and now I am panicking&#8217;. Don&#8217;t let the panic get to you and set the pace back where it belongs by replying via email.</p>
<p>There is no need to get angry or resentful of the client. They usually are not aware of what they are doing or of their emotional state, but don&#8217;t let it get to you.</p>
<h2>5. If you happen to be delayed</h2>
<p>Sometimes you just got your timing wrong or you are delayed by other things. You know the client is going to call to see what&#8217;s going on. Fair enough! The trick here is to get in touch with him/her before they do. As soon as you feel the need to push back the deadline &#8211; and that is BEFORE the deadline &#8211; get in touch with the client, explain the situation, and suggest an alternative schedule. It is the honest and considerate thing to do as it allows clients and partners to re-adjust as well.</p>
<p>Hope that helps. Any other tip to share, please leave them in the comments <img src='http://majweb.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/5HZqDZ6xOFA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/5-tips-to-avoid-being-put-under-pressure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/5-tips-to-avoid-being-put-under-pressure/</feedburner:origLink></item>
		<item>
		<title>WP_Query, conditional tags, pre_get_posts, get_posts, query_posts: when to use what</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/A5yvhi59ooU/</link>
		<comments>http://majweb.co.uk/wp_query-conditional-tags-pre_get_posts-get_posts-query_posts-when-to-use-what/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 09:52:04 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[Wordpress development]]></category>
		<category><![CDATA[wordpress loop]]></category>
		<category><![CDATA[wordpress query]]></category>

		<guid isPermaLink="false">http://majweb.co.uk/?p=985</guid>
		<description><![CDATA[There are various methods available to interact with the WordPress query and it can get confusing to identify which one is best for a particular purpose. Here are the conclusions I drew from diving in the WordPress Codex,  in the form of a (hopefully) simple table. Follow the links to the Codex for technical details <a class="readMore" href="http://majweb.co.uk/wp_query-conditional-tags-pre_get_posts-get_posts-query_posts-when-to-use-what/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p>There are various methods available to interact with the WordPress query and it can get confusing to identify which one is best for a particular purpose. Here are the conclusions I drew from diving in the WordPress Codex,  in the form of a (hopefully) simple table. Follow the links to the Codex for technical details &#8211; or post your questions below!</p>
<table>
<tbody>
<tr>
<th>What you want to do</th>
<th>Functions/tags to use</th>
<th>Notes and warnings</th>
</tr>
<tr>
<td rowspan="2">Getting information about the current query/loop</td>
<td>The <a title="WP_Query class reference in the WordPress codex" href="http://codex.wordpress.org/Class_Reference/WP_Query#Interacting_with_WP_Query" target="_blank">WP_Query</a> object</td>
<td>Very rarely needed. Make sure you&#8217;ve run out of options with conditional tags and tags available in the loop</td>
</tr>
<tr>
<td><a title="Conditional tags page in the WordPress codex" href="http://codex.wordpress.org/Conditional_Tags" target="_blank">Conditional tags</a></td>
<td>Particularly useful in plugin development to limit actions to certain types of pages</td>
</tr>
<tr>
<td rowspan="2">Modifying the main query/loop</td>
<td>the <a title="Wordpress codex on the pre_get_posts action" href="http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts" target="_blank">pre_get_post</a> action</td>
<td>Whish I had found about that sooner!!!<br />
Requires a good knowledge of the structure of the <a title="WP_Query class, $query object" href="http://codex.wordpress.org/Class_Reference/WP_Query" target="_blank">$query</a> object</td>
</tr>
<tr>
<td>the <a title="Wordpress codex on the query_post function" href="http://codex.wordpress.org/Function_Reference/query_posts" target="_blank">query_posts</a> function</td>
<td>Usage discouraged<br />
Messes up with pagination, see <a title="How to fix pagination when used query_posts" href="http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html" target="_blank">fix here</a></td>
</tr>
<tr>
<td rowspan="2">Generating a secondary loop (e.g. post listing in a widget)</td>
<td>the <a title="get_posts function reference in the WordPress codex" href="http://codex.wordpress.org/Function_Reference/get_posts" target="_blank">get_posts</a> function</td>
<td>Best suited tool for this purpose!</td>
</tr>
<tr>
<td>new instance of <a title="The WP_Query class reference" href="http://codex.wordpress.org/Class_Reference/WP_Query" target="_blank">WP_Query</a></td>
<td>Just use get_posts!</td>
</tr>
</tbody>
</table>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/A5yvhi59ooU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/wp_query-conditional-tags-pre_get_posts-get_posts-query_posts-when-to-use-what/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/wp_query-conditional-tags-pre_get_posts-get_posts-query_posts-when-to-use-what/</feedburner:origLink></item>
		<item>
		<title>JQuery in WordPress: 3 little things to avoid much head scratching</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/A6CDJPPm5tI/</link>
		<comments>http://majweb.co.uk/jquery-in-wordpress-3-little-things-to-avoid-much-head-scratching/#comments</comments>
		<pubDate>Thu, 24 May 2012 09:05:40 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[Wordpress development]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin development]]></category>
		<category><![CDATA[theme development]]></category>

		<guid isPermaLink="false">http://majweb.co.uk/?p=940</guid>
		<description><![CDATA[Don&#8217;t get me wrong, I really like the WordPress doc. That&#8217;s one of the main reasons I&#8217;m sticking to WordPress. Yet&#8230; I found that learning to integrate and use jQuery in themes and plugins was a frustratingly hiccupy process. You know, when you spend ages scratching your head over message-less bugs just because there&#8217;s one <a class="readMore" href="http://majweb.co.uk/jquery-in-wordpress-3-little-things-to-avoid-much-head-scratching/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p><a href="http://majweb.co.uk/jquery-in-wordpress-3-little-things-to-avoid-much-head-scratching/jquery-logo/" rel="attachment wp-att-943"><img class="alignright size-medium wp-image-943" title="jquery logo" src="http://majweb.co.uk/wp-content/uploads/2012/05/jquery-logo-300x225.jpg" alt="jquery logo" width="300" height="225" /></a>Don&#8217;t get me wrong, I really like the WordPress doc. That&#8217;s one of the main reasons I&#8217;m sticking to WordPress. Yet&#8230; I found that learning to integrate and use jQuery in themes and plugins was a frustratingly hiccupy process. You know, when you spend ages scratching your head over message-less bugs just because there&#8217;s one tiny piece of information you did not have.</p>
<p>To save YOU those agonizingly slow and frustrating moments, <strong>here are a few things that I wish had been made clearer about jQuery in WordPress.</strong></p>
<h2>1. It&#8217;s already in!!</h2>
<p>There is <strong>no need to add a copy of jQuery</strong> to your WordPress theme or plugin. It&#8217;s already there in the core package. You <strong>still need to call it though</strong>, just in case it wasn&#8217;t loaded yet.</p>
<p>Insert it using the <a title="Wordpress codex wp_enqueue_script" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">wp_enqueue_script</a> function; the handle for jQuery is simply&#8230; &#8216;jquery&#8217;.</p>
<h2>2. Calling &#8216;$&#8217; doesn&#8217;t work!</h2>
<p>Nope you cannot write<br />
<code>$(document).ready(function(){});</code></p>
<p>as the &#8216;$&#8217; is not recognized in Worpdress. You need to use &#8216;jQuery&#8217; instead, like so<br />
<code>jQuery(document).ready(function(){});</code></p>
<p>If you absolutely want to use the &#8216;$&#8217; call, you simply need to pass it as a variable from function to function.<br />
<code>jQuery(document).ready(function($){<br />
anotherfunction($);<br />
});</code></p>
<h2>3. Passing variables to jQuery</h2>
<p>At times, you will want to provide server-side variables to jQuery, a good example would be the path to your theme or plugin. But if you insert your script properly using the<a title="Wordpress codex on wp_enqueue_script" href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank"> wp_enqueue_script</a> function, how do you pass those variables to the jQuery environment?</p>
<p>Using the <a title="Wordpress codex on wp_localize_script" href="http://codex.wordpress.org/Function_Reference/wp_localize_script" target="_blank">wp_localize_script</a> function, which assigns an object containing the various variables you wish to transmit to your script.</p>
<p style="text-align: left;">See this page for details on its use: <a href="http://codex.wordpress.org/Function_Reference/wp_localize_script">http://codex.wordpress.org/Function_Reference/wp_localize_script</a></p>
<p>More in future posts! Any questions, please ask in the comments <img src='http://majweb.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/A6CDJPPm5tI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/jquery-in-wordpress-3-little-things-to-avoid-much-head-scratching/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/jquery-in-wordpress-3-little-things-to-avoid-much-head-scratching/</feedburner:origLink></item>
		<item>
		<title>Who uses Drupal exactly?</title>
		<link>http://feedproxy.google.com/~r/MajWebDevelopmentWebProStuff/~3/oIF3zRzoO7E/</link>
		<comments>http://majweb.co.uk/who-uses-drupal-exactly/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 08:31:30 +0000</pubDate>
		<dc:creator>Marie</dc:creator>
				<category><![CDATA[CMSs]]></category>
		<category><![CDATA[Web pro stuff]]></category>
		<category><![CDATA[drupal]]></category>

		<guid isPermaLink="false">http://localhost/majweb/?p=187</guid>
		<description><![CDATA[This is the conclusion of my short-lived romance with Drupal &#8211; Drupal 7, to be precise. It all started 8 months ago, at a time when I started feeling all too comfortable with WordPress. So I thought I&#8217;d see what else was out there. Maybe Drupal would be more appropriate for developing biggish applications. After <a class="readMore" href="http://majweb.co.uk/who-uses-drupal-exactly/"><b>Read more &#62;</b></a>]]></description>
				<content:encoded><![CDATA[<p><img class=" wp-image-746 alignright" title="Drupal logo" src="http://majweb.co.uk/wp-content/uploads/2012/02/druplicon.small_.png" alt="Drupal logo" />This is the conclusion of my short-lived romance with Drupal &#8211; Drupal 7, to be precise.</p>
<p>It all started 8 months ago, at a time when I started feeling all too comfortable with WordPress. So I thought I&#8217;d see what else was out there. Maybe Drupal would be more appropriate for developing biggish applications. After all, I had heard a lot of good things about it.</p>
<p>You know how love stories go at first. The modularity, the custom data types, the views module&#8230; I was under Drupal&#8217;s spell. Soon, all I wanted was to get hands on. Yet, Drupal was playing hard to get: <strong>its documentation was wrapped in an aura of mystery</strong>. Am I the only one to find it confusing that, despite significant differences between successive versions, pages relevant to Drupal versions 5, 6 and 7 are jumbled up together?</p>
<p>I thought I&#8217;d persevere, so I did what I usually do when the online material is not great: I bought a textbook, <a href="http://www.apress.com/9781430228387">Pro Drupal 7 development</a> by Tomlinson and VanDyk. The book was OK &#8211; though I bought it before realizing <strong>how wide the differences between Drupal versions were</strong> so I had to return my originally purchased &#8220;Pro Drupal 6 development&#8221; in favor of the one cited above -_-</p>
<p>Theming was OK too&#8230; as long as I didn&#8217;t want to override native functions. Somehow, even when staying as close as possible from code found in the book or online, none of my overriding functions would work. That&#8217;s OK&#8230; (see, I have the patience of an angel) I quickly found out that when I wanted to create my own functions, the vast majority of the time, a module already existed for that.</p>
<p>That&#8217;s how I ended up spending all my time in the admin area, which, to say it plainly, I just hate. Forgetting hierarchy in favour of modularity is fine for a computer&#8230; not so great for a humain brain. There were too many ways of getting to the same page while none of these ways seemed obvious and clear. The default editor, guys&#8230; come on! I know it&#8217;s fun to install and setup modules (erm&#8230;) but is it not just minimum standard to have a somewhat rich editor? And that&#8217;s when the question first popped into my mind? WHO USES THIS? WHO IS THIS FOR?</p>
<p>I wanted to code but was pushed back to the graphical interface by the unclear documentation. Yet <strong>the interface is not really intuitive</strong> and the editor is SO plain you&#8217;re tempted to shove HTML directly in there. But I can&#8217;t ask my client to do that when they update their site!</p>
<p>So again I thought maybe it&#8217;s for big teams of developer/webmasters but considering the clunkiness of Drupal and the training required to use the interface, <strong>you might as well train your team to code using a proper, flexible framework such as cakePHP or Zend</strong>.</p>
<p>The question came back to life when I installed a Drupal website on my shared server. It was <strong>unbearably slow</strong>! I did a bit of research online to notice that it was a common pitfall of Drupal 7. To make it work at a decent speed, you need to be able to optimise your server for it&#8230; as if me or any of my clients would have that kind of access to their server!</p>
<p>Oh, well&#8230; I realized my mistake and am back in the arms of WordPress now and if it doesn&#8217;t satisfies a projects needs, I&#8217;ll use one of the many PHP frameworks!</p>
<img src="http://feeds.feedburner.com/~r/MajWebDevelopmentWebProStuff/~4/oIF3zRzoO7E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://majweb.co.uk/who-uses-drupal-exactly/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://majweb.co.uk/who-uses-drupal-exactly/</feedburner:origLink></item>
	</channel>
</rss>
