<?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>Periodical solutions for everyday problems</title>
	<atom:link href="http://blog.mariokostelac.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mariokostelac.com</link>
	<description>WordPress Hacks, Tips and tricks</description>
	<lastBuildDate>Mon, 13 Feb 2012 22:24:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Google XML Sitemaps with Multisite support</title>
		<link>http://blog.mariokostelac.com/google-xml-sitemaps-multisite/</link>
		<comments>http://blog.mariokostelac.com/google-xml-sitemaps-multisite/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 18:30:46 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://blog.mariokostelac.com/?p=198</guid>
		<description><![CDATA[Google XML Sitemaps with Multisite support is just modified Google XML Sitemaps plugin, originally written by Arne Brachhold. Some time ago I was employed to work on Gnosis.hr site, which needs to drive two sites on one WordPress installation &#8211; &#8230; <a href="http://blog.mariokostelac.com/google-xml-sitemaps-multisite/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Google XML Sitemaps with Multisite support</strong> is just modified Google XML Sitemaps plugin, originally written by <a href="www.arnebrachhold.de" target="_blank">Arne Brachhold</a>.</p>
<p>Some time ago I was employed to work on <a title="Gnosis.hr " href="http://www.gnosis.hr" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.gnosis.hr?referer=');">Gnosis.hr</a> site, which needs to drive two sites on one WordPress installation &#8211; one for Croatian version and another for the English one. Everything seemed fine until I realized that Google XML Sitemaps isn&#8217;t working with Multi site installation.</p>
<p>My modification changes this &#8211; you can have numerous sites on one installation and each of them can have own sitemap.</p>
<h3>Installation:</h3>
<ul>
<li>Install &#8220;Google XML Sitemaps with Multisite support&#8221; through the WordPress admin (or <a title="Google XML Sitemaps with Multisite support by Mario Kostelac" href="http://wordpress.org/extend/plugins/google-xml-sitemaps-with-multisite-support" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/google-xml-sitemaps-with-multisite-support?referer=');">download</a>)</li>
<li>Create &#8220;sitemaps&#8221; directory in directory where you&#8217;ve installed WordPress</li>
<li>Make &#8220;sitemaps&#8221; writeable&#8221;</li>
</ul>
<p>That&#8217;s it. 99% percent of work is done by Arne so, thank you Arne. I hope that our projects will merge into the one in the near future.</p>
<p><strong>UPDATE</strong>: Plugin is no more supported since there are many other plugins doing the same thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/google-xml-sitemaps-multisite/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Adding default custom fields on new posts in WordPress</title>
		<link>http://blog.mariokostelac.com/adding-default-custom-fields-on-new-posts/</link>
		<comments>http://blog.mariokostelac.com/adding-default-custom-fields-on-new-posts/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 09:01:37 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Codebox]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.mariokostelac.com/?p=190</guid>
		<description><![CDATA[Custom fields are essential part of every WordPress site. You know how to add it &#8211; Enter new &#8211; [type some name] &#8211; [type some content] &#8211; Add custom field. It&#8217;s not complicated process, but it is not as simple &#8230; <a href="http://blog.mariokostelac.com/adding-default-custom-fields-on-new-posts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Custom fields are essential part of every WordPress site. You know how to add it &#8211; Enter new &#8211; [type some name] &#8211; [type some content] &#8211; Add custom field. It&#8217;s not complicated process, but it is not as simple as it could be, especially if all of your posts need to have same custom fields, for example, price, size or some very general values. If it is your case, use this snippet and make your life easier.</p>
<pre>
&lt;pre&gt;add_action(&#039;wp_insert_post&#039;, &#039;mk_set_default_custom_fields&#039;);

function mk_set_default_custom_fields($post_id)
{
	if ( $_GET[&#039;post_type&#039;] != &#039;page&#039; ) {

		add_post_meta($post_id, &#039;price&#039;, &#039;&#039;, true);
		add_post_meta($post_id, &#039;link&#039;, &#039;&#039;, true);

	}

	return true;
}&lt;/pre&gt;
</pre>
<p>Simple, right?</p>
<p>You can put numerous custom fields or put just one. It&#8217;s up to you.<br />
Oh, I forgot. This adds an empty custom field (with no value). For adding custom field with some value add 
<pre>
&lt;pre&gt;add_post_meta($post_id, &#039;custom field name&#039;, &#039;custom field value&#039;, true);&lt;/pre&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/adding-default-custom-fields-on-new-posts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>No, you can&#8217;t have a million files in your directory or &#8220;why WordPress&#8217;s storing pictures into subdirectories (year/month) is good?&#8221;</title>
		<link>http://blog.mariokostelac.com/no-you-cant-have-a-million-files-in-your-directory-or-why-wordpresss-storing-pictures-into-subdirectories-yearmonth-is-good/</link>
		<comments>http://blog.mariokostelac.com/no-you-cant-have-a-million-files-in-your-directory-or-why-wordpresss-storing-pictures-into-subdirectories-yearmonth-is-good/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 17:23:05 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[Learned on harder way]]></category>
		<category><![CDATA[filesystem]]></category>
		<category><![CDATA[ftp]]></category>

		<guid isPermaLink="false">http://blog.mariokostelac.com/?p=183</guid>
		<description><![CDATA[No, you can&#8217;t have a million files in your directory. Precisely, you can &#8211; but you should not have. Asking why? Today I was asked to transfer one old site to WordPress platform and everything seems so fine &#8211; I&#8217;ve &#8230; <a href="http://blog.mariokostelac.com/no-you-cant-have-a-million-files-in-your-directory-or-why-wordpresss-storing-pictures-into-subdirectories-yearmonth-is-good/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>No, you can&#8217;t have a million files in your directory. Precisely, you can &#8211; but you should not have.</p>
<h3>Asking why?</h3>
<p>Today I was asked to transfer one old site to WordPress platform and everything seems so fine &#8211; I&#8217;ve created the script that sniffs through old system&#8217;s database, adds new posts (4000+), fix images URLs (4000+ posts x few images), redirect old URLs. But then, I noticed that some<strong> pictures are missing</strong>. For real, they&#8217;re not missing, but they are invisible on file list (direct link to file works), except first 1998 files.<span id="more-183"></span>Like every other programmer would do, I&#8217;ve searched for ext2/3/4 specifications and gave specific attention to filesystem limits, but haven&#8217;t found any small number like 2000 (I see only first 1998 files + . + ..). All numbers was very large and base is always 2 &#8211; you cannot multiple 2 with 2 x times and get 1998 or 2000 so I realized that limit is not set by filesystem. Hosting provider told me that the limit is set by FTP recursion (read sth about that on <a href="http://www.unixsurgeon.com/kb/how-to-change-recursion-limitfile-limit-list-in-pure-ftp.html" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.unixsurgeon.com/kb/how-to-change-recursion-limitfile-limit-list-in-pure-ftp.html?referer=');">UnixSurgeon</a>) and this variable cannot be changed because site is on shared hosting. Lame.</p>
<h3>Is there a solution?</h3>
<p>Yes, there is. Changing ftp recursion limit would fix this issue. Files are not deleted, they&#8217;re just not visible in file listing &#8211; direct link to files works. There must be the way to download and save them (without clicking Save picture as&#8230;).</p>
<h3>So, what if you can&#8217;t change recursion limit?</h3>
<p>You can always store your pictures into subdirectories so I have to create PHP script that reallocates these photos. Organize your photos/files on beginning so you won&#8217;t have problems like me, you won&#8217;t have invisible files.</p>
<h3>And the question: What is the maximum number of files that I can hold in my directory?</h3>
<p>A: Depends on filesystem, but check the ftp recursion limit first.</p>
<p><strong>Btw, that&#8217;s why WordPress&#8217;s storing pictures into subdirectories  (year/month) is good.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/no-you-cant-have-a-million-files-in-your-directory-or-why-wordpresss-storing-pictures-into-subdirectories-yearmonth-is-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New plugin in the repository – Simple Coming soon is out</title>
		<link>http://blog.mariokostelac.com/simple-coming-soon/</link>
		<comments>http://blog.mariokostelac.com/simple-coming-soon/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 16:21:06 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[coming soon]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://blog.mariokostelac.com/?p=170</guid>
		<description><![CDATA[UPDATE: Mukul Hinge wrote a great how-to article which explains how to fix your site when coming soon page is still there, even after deactivating the plugin &#8211; Read how. Some time ago I was asked to work on two &#8230; <a href="http://blog.mariokostelac.com/simple-coming-soon/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div>
<p><strong>UPDATE</strong>: Mukul Hinge wrote a great how-to article which explains how to fix your site when coming soon page is still there, even after deactivating the plugin &#8211; <a title="Read how." href="http://www.mukulhinge.com/uncategorized/wordpress-simple-coming-soon-plugin/" onclick="pageTracker._trackPageview('/outgoing/www.mukulhinge.com/uncategorized/wordpress-simple-coming-soon-plugin/?referer=');">Read how</a>.</p>
<p><a title="Read more about Simple Coming soon plugin" href="http://blog.mariokostelac.com/simple-coming-soon/" target="_self"><img class="alignnone size-full wp-image-177" title="Great example of coming soon page - created by Marko Prljić" src="http://blog.mariokostelac.com/files/2010/08/Untitled-1.jpg" alt="Great example of coming soon page - created by Marko Prljić" width="600" height="160" /></a><br />
Some time ago I was asked to work on two projects for <a title="Marko Prljić" href="http://markoprljic.iz.hr/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/markoprljic.iz.hr/?referer=');">Marko Prljić</a> – very talented designer from Croatia. Both have needed option to show coming soon page in case that user is not logged in.</p>
<p>At first, this feature was solved by adding code into functions.php file, but today the plugin is born. <a title="Read more about Simple coming soon" href="http://blog.mariokostelac.com/simple-coming-soon/#more-170">Download it and have nice coming soon page (with countdown) or create the custom one.</a><span id="more-170"></span></p>
<p>Process is very simple:</p>
<ul>
<li><a href="http://wordpress.org/extend/plugins/simple-coming-soon-and-under-construction/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/simple-coming-soon-and-under-construction/?referer=');">download it from wordpress.org repository</a></li>
<li>upload and activate it</li>
<li>select &#8220;coming soon&#8221; state and save changes OR</li>
<li>create coming-soon.php page into active theme&#8217;s directory</li>
</ul>
</div>
<div>
<p>&nbsp;</p>
<p>For now (version 1.0) has only one built-in template (special thanks to Madalin Tudose from <a title="Free coming soon template on ourtuts" href="http://www.ourtuts.com/free-site-under-construction-template/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.ourtuts.com/free-site-under-construction-template/?referer=');">ourtuts</a>; also, I&#8217;m looking for designer who will donate coming soon template) with countdown option and links to social network profiles – you&#8217;ll see on option pages.</p>
<p>If you&#8217;re in need to create the custom one, just name it coming-soon.php and place it in active theme&#8217;s directory (for ex. public_html/wp-content/themes/my-theme/coming-soon.php).</p>
<p>If you have any problem related to this plugin or need some assistance, ask in a comment and I&#8217;ll reply to you as soon as I can.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/simple-coming-soon/feed/</wfw:commentRss>
		<slash:comments>72</slash:comments>
		</item>
		<item>
		<title>Easy browser (and OS) hacking on WordPress</title>
		<link>http://blog.mariokostelac.com/easy-browser-and-os-hacking-with-wordpress/</link>
		<comments>http://blog.mariokostelac.com/easy-browser-and-os-hacking-with-wordpress/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 16:40:11 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[browser hacks]]></category>
		<category><![CDATA[browser sniffing]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.mariokostelac.com/?p=158</guid>
		<description><![CDATA[Hacking certain browsers or operating systems has always been a tricky topic. Work on a new site forced me to make browser (and OS!) hacking easy. Read on and learn how to select certain browser and OS in wordpress very &#8230; <a href="http://blog.mariokostelac.com/easy-browser-and-os-hacking-with-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hacking certain browsers or operating systems has always been a tricky topic. Work on a new site forced me to make browser (and OS!) hacking easy. <a title="Learn easy browser hacking" href="http://blog.mariokostelac.com/easy-browser-and-os-hacking-with-wordpress/" target="_self">Read on and learn how to select certain browser and OS in wordpress very easily.</a><br />
<span id="more-158"></span>The code is in the box below. Only thing you have to do is to paste these lines into your functions.php file of your theme directory (if there is no functions.php file, just create it).</p>
<pre>
&lt;pre&gt;&amp;lt;?php

	add_filter(&#039;body_class&#039;, &#039;mk_browser_hacks&#039;);

	function mk_browser_hacks($classes)
	{

		$user_agent = $_SERVER[&#039;HTTP_USER_AGENT&#039;];
		// detecting OS
		if ( stripos($user_agent, &#039;windows&#039;) !== false ) {
			$classes[] = &#039;win&#039;;
		}
		elseif ( stripos($user_agent, &#039;macintosh&#039;) !== false ) {
			$classes[] = &#039;mac&#039;;
		}
		elseif ( stripos($user_agent, &#039;iphone&#039;) !== false ) {
			$classes[] = &#039;iphone&#039;;
		}

		// detecting rendering engine
		if ( stripos($user_agent, &#039;AppleWebKit&#039;) !== false ) {
			$classes[] = &#039;webkit&#039;;
		}
		elseif ( stripos($user_agent, &#039;Gecko&#039;) !== false ) {
			$classes[] = &#039;gecko&#039;;
		}
		elseif ( stripos($user_agent, &#039;MSIE&#039;) !== false ) {
			$classes[] = &#039;msie&#039;;
		}
		elseif ( stripos($user_agent, &#039;presto&#039;) !== false ) {
			$classes[] = &#039;presto&#039;;
		}

		// detecting browsers
		if ( stripos($user_agent, &#039;chrome&#039;) !== false ) {
			$classes[] = &#039;chrome&#039;;
		}
		elseif ( stripos($user_agent, &#039;safari&#039;) !== false ) {
			$classes[] = &#039;safari&#039;;
		}
		elseif ( stripos($user_agent, &#039;firefox&#039;) !== false ) {
			$classes[] = &#039;firefox&#039;;
		}
		elseif ( stripos($user_agent, &#039;opera&#039;) !== false ) {
			$classes[] = &#039;opera&#039;;
		}

		// browser versions
		if ( stripos($user_agent, &#039;MSIE 6.0&#039;) !== false ) {
			$classes[] = &#039;ie-6&#039;;
			$classes[] = &#039;ie-lt-7&#039;;
			$classes[] = &#039;ie-lt-8&#039;;
			$classes[] = &#039;ie-lt-9&#039;;
		}
		elseif ( stripos($user_agent, &#039;MSIE 7.0&#039;) !== false ) {
			$classes[] = &#039;ie-gt-6&#039;;
			$classes[] = &#039;ie-7&#039;;
			$classes[] = &#039;ie-lt-8&#039;;
			$classes[] = &#039;ie-lt-9&#039;;
		}
		elseif ( stripos($user_agent, &#039;MSIE 8.0&#039;) !== false ) {
			$classes[] = &#039;ie-gt-6&#039;;
			$classes[] = &#039;ie-gt-7&#039;;
			$classes[] = &#039;ie-8&#039;;
			$classes[] = &#039;ie-lt-9&#039;;
		}

		return $classes;

	}

?&amp;gt;&lt;/pre&gt;
</pre>
<h3>What does this code do?</h3>
<p>It is triggered when body_class function is called.<br />
So, start of your body tag should look like &lt;body &lt;?php body_class(); ?&gt; and magic begins. Code adds browser/OS specific classes to your body tag.</p>
<h3>Browser hacking is now piece of a cake</h3>
<p>Your CSS files is location where your hacks have to be placed.</p>
<p>Hacking #content for firefox &#8211; .firefox #content</p>
<p>Hacking #content for chrome &#8211; .chrome #content</p>
<p>Hacking #content for opera &#8211; .opera #content</p>
<p>Hacking #content for IE &#8211; .msie #content</p>
<p>You can hack also for iphone &#8211; .iphone [your selector]</p>
<h3>Hacking OS-es?</h3>
<p>It is supported too &#8211; .mac for macintosh, .win for windows, .iphone for iPhone.<br />
It is possible to select certain browser on certain OS &#8211; just combine these classes.</p>
<p>For example &#8211; firefox on OS X &#8211; .mac.firefox (yes, without whitespace, it means that some element has both classes).</p>
<h3>Hacking Internet Explorer is no more pain in the ass!</h3>
<p>.ie-6 class triggers only on internet explorer 6, same for IE 7, 8 and version 9.<br />
There is no more need for including external css files for Internet Explorer.<br />
If you add .ie-lt-8 (lt = less than), it will trigger only on IEs below 8.</p>
<h3>Conclusion</h3>
<p>I think there&#8217;s not many people that like browser hacking, but sometimes it is really must-have skill. Paste this code into your functions.php and forget about all browser specific comments and selectors.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/easy-browser-and-os-hacking-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improve your SEO on NextGen galleries</title>
		<link>http://blog.mariokostelac.com/nextgen-seo/</link>
		<comments>http://blog.mariokostelac.com/nextgen-seo/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 19:45:08 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[nextgen seo titles]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://mariokostelac.com/?p=106</guid>
		<description><![CDATA[NextGen Gallery is best gallery plugin for WordPress so far, but we all know that it is not perfect. After doing few sites based on WordPress plus NextGen, it has become very annoying  to have page titles like „Album 12 &#8230; <a href="http://blog.mariokostelac.com/nextgen-seo/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a title="Learn how to improve your SEO on NextGen galleries" href="http://blog.mariokostelac.com/nextgen-seo/" target="_self"><img class="alignnone size-full wp-image-151" title="Plugin configuration" src="http://blog.mariokostelac.com/files/2010/04/Untitled-1.jpg" alt="" width="600" height="160" /></a>NextGen Gallery is best gallery plugin for WordPress so far, but we all know that it is not perfect. After doing few sites based on WordPress plus NextGen, it has become very annoying  to have page titles like „Album 12 – Gallery 34 – Picture 567“ so I decided to fix it through the plugin. <a title="Download NextGen Gallery SEO titles" href="http://blog.mariokostelac.com/nextgen-seo/" target="_self">Download it and improve SEO on every page generated by NextGen Gallery.</a><span id="more-106"></span></p>
<p><strong>Update July, 18, 2010: 0.2.2 version is out. It works on WP3 with the newest version of NextGen Gallery.<br />
In this version Alt text is displayed in title bar like chris suggested.</strong></p>
<p>The plugin modifies page titles genereated by NextGen, one very important part of SEO.</p>
<h3>Installation and use</h3>
<p>Before installing my plugin, your Gallery have to be installed and activated.</p>
<ol>
<li><a title="Download NextGen Gallery SEO titles" href="http://wordpress.org/extend/plugins/nextgen-gallery-seo-titles/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/nextgen-gallery-seo-titles/?referer=');">Download the plugin</a></li>
<li>Upload whole  `nextgen-gallery-seo-titles` directory into `wp-content/plugins/`</li>
<li>Activate it</li>
<li>Go to Gallery-&gt;Page titles and configure the separator and elements of title</li>
</ol>
<p>That is all you have to do. I prefer installing from WordPress admin menu – it is faster and doesn&#8217;t require ftp access, but it is up to you.</p>
<p>If you have any questions, feel free to post a comment or drop me a line on mario.kostelac[at]gmail.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/nextgen-seo/feed/</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
		<item>
		<title>Your editors don&#8217;t like the dashboard? Redirect them!</title>
		<link>http://blog.mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/</link>
		<comments>http://blog.mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 21:49:26 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Codebox]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://mariokostelac.com/?p=82</guid>
		<description><![CDATA[Since a small team (1dva) I freelanced for had migrated to WordPress, I&#8217;ve heard numerous times that old CMS was better. I know that our customers do not know why it is better, but I have to find out why &#8230; <a href="http://blog.mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/"><img class="alignnone size-full wp-image-154" title="Learn how to redirect your users from WordPress Dashboard" src="http://blog.mariokostelac.com/files/2010/03/index.jpg" alt="Wordpress Dashboard" width="600" height="160" /></a>Since a small team (<a title="1dva - grafički studio za vizualne komunikacije" href="http://www.1dva.hr" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.1dva.hr?referer=');">1dva</a>) I freelanced for had migrated to WordPress, I&#8217;ve heard numerous times that old CMS was better. I know that our customers do not know why it is better, but I have to find out why they more like the Nano. The answer is more simple than I have expected – our customers don&#8217;t like the Dashboard, it is more friendly to go directly to Edit Posts page. Read <a href="http://mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/" onclick="pageTracker._trackPageview('/outgoing/mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/?referer=');">how to redirect wordpress user from Dashboard</a>.<span id="more-82"></span></p>
<h3>The function</h3>
<p>is below, just paste it into your functions.php file.</p>
<pre>add_filter('login_redirect', 'dashboard_redirect');
function dashboard_redirect($url) {
global $current_user;
get_currentuserinfo();
$level = (int) $current_user-&gt;wp_user_level;
if ( $level &lt; 10 &amp;&amp; $level &gt; 3 ) {
$url = 'wp-admin/edit.php';
}
return $url;
}</pre>
<h3>The logic is very simple</h3>
<p>The first line is crucial and should be very clear. In short, add_filter adds <a title="Read about hooks, filters an actions on WordPress Codex" href="http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters" target="_blank" onclick="pageTracker._trackPageview('/outgoing/codex.wordpress.org/Plugin_API_Hooks.2C_Actions_and_Filters?referer=');">filter </a>on login_redirect so our function will change the url so your user will be redirected on after hitting the &#8220;Log in&#8221; button.</p>
<p>This is the only logic we have to know. Rest of the code gets the current user level and avoids redirecting users leveled with 10 or below 3.</p>
<h3>This is just one of the uses</h3>
<p>Now, when you know how to change the url of page that is loaded after logging in, only your imagination should be the limit. Uses are uncountable. You could redirect only certain users or you could redirect users to a specific plugin. Listen to your users, maybe they don&#8217;t like the Dashboard too?!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/your-editors-dont-like-the-dashboard-redirect-them/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Creating stylesheet for Headline Replacement</title>
		<link>http://blog.mariokostelac.com/creating-stylesheet-for-headline-replacement/</link>
		<comments>http://blog.mariokostelac.com/creating-stylesheet-for-headline-replacement/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 08:51:34 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[beginner]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[headline replacement]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://mariokostelac.com/?p=51</guid>
		<description><![CDATA[Headline Replacement can be really useful, especially because we are able to choose what titles exactly we want to replace. Version 0.1.1 is out, but the plugin is still difficult to handle with. You have to display image as the &#8230; <a href="http://blog.mariokostelac.com/creating-stylesheet-for-headline-replacement/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Headline Replacement can be really useful, especially because we are able to choose what titles exactly we want to replace. Version 0.1.1 is out, but the plugin is still difficult to handle with. You have to display image as the <em>img</em> tag what is not the proper way (according the W3 standards) if the image is just replacement for the title . Let&#8217;s see how to create automatic stylesheet and avoid <em>img </em>tags.<span id="more-51"></span></p>
<h3>The Idea</h3>
<p>is to use existing functions and create stylsheet with replacement styles</p>
<h3>Something you probably don&#8217;t know, but you should</h3>
<p>If you take a look on <a title="Headline Replacement - initial release" href="http://mariokostelac.com/headline-replacement/" onclick="pageTracker._trackPageview('/outgoing/mariokostelac.com/headline-replacement/?referer=');">initial release of plugin</a>, you could notice that one function is not explained at all. It is headline_image_get();</p>
<p>The function has only one argument and it is the ID of the post, and it returns an array formatted as below:</p>
<pre>Array
	(
		[0] =&gt; http://mariokostelac.com/example1.jpg
		[1] =&gt; 350
		[2] =&gt; 40
		[3] =&gt;
	)</pre>
<p>The first returned element is the url of replacement image, second is width and the third is height.</p>
<h3>The next step</h3>
<p>Now you know everything you should, it is all about creating the replacement styles.<br />
In short, we have to loop the posts on loaded page, check existence of replacement image and create particular style.<br />
If you are beginner with WP, it could be tricky to loop the posts and hold the pointer on the first one. Not surprisingly, WP developers have made it easy. You can go through the loop and reset the pointer (see <a title="WP codex - wp_reset_query function" href="http://codex.wordpress.org/Function_Reference/wp_reset_query" target="_blank" onclick="pageTracker._trackPageview('/outgoing/codex.wordpress.org/Function_Reference/wp_reset_query?referer=');"><em>wp_reset_query</em></a>) in order to prepare everything for further execution. Otherwise, your pointer will be after the last post and no code will be executed in the main loop what results no visible posts.<br />
So the code could look like one in the box. Just put it in the head section:</p>
<pre>&lt;style type="text/css"&gt;
&lt;?php if ( have_posts() ): ?&gt;
&lt;?php while ( have_posts() ): the_post(); ?&gt;
&lt;?php $img = headline_image_get( get_the_ID() ); ?&gt;
&lt;?php if ( $img[0] != '' ): ?&gt;
h2#title-&lt;? the_ID(); ?&gt; {
background: url('&lt;?= $img[0] ?&gt;') 0 0 no-repeat;
height: &lt;?= $img[2] ?&gt;px;
overflow: hidden;
text-indent: -9999px;
width: &lt;?= $img[1] ?&gt;px;
}
&lt;?php endif; ?&gt;
&lt;?php endwhile; ?&gt;
&lt;?php endif; ?&gt;
&lt;/style&gt;</pre>
<p>The conditions in the loop is equal to &#8220;if replacement image exists&#8221;, and is followed by replacement style. According to the rules of CSS, you can change selector  to anyone you want.</p>
<h3>The last action, changing the markup</h3>
<p>Open your index.php, single.php and other files that contain the loop and make your post titles have <em>id </em>attribute equal to &#8220;post-{post_ID}&#8221;.<br />
It should not be too hard, but here is the code example:<br />
<code>&lt;h2 id="title-&lt;?php the_ID(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;</code></p>
<h3>But my markup and selectors are not the same on the blog page and post page?!</h3>
<p>No problem, there are <a title="Wordpress Conditional Tags" href="http://codex.wordpress.org/Conditional_Tags" target="_blank" onclick="pageTracker._trackPageview('/outgoing/codex.wordpress.org/Conditional_Tags?referer=');">Conditional tags</a> so you are able to create different stylesheets depending on page types and needs.<br />
The most simple example:</p>
<pre>&lt;style type="text/css"&gt;
&lt;?php if ( is_home() )
$selector = "h2#title-";
else
$selector = "h1#title-";
&lt;?php if ( have_posts() ): ?&gt;
&lt;?php while ( have_posts() ): the_post(); ?&gt;
&lt;?php $img = headline_image_get( get_the_ID() ); ?&gt;
&lt;?php if ( $img[0] != '' ): ?&gt;
&lt;?= $selector . get_the_ID(); ?&gt; {
background: url('&lt;?= $img[0] ?&gt;') 0 0 no-repeat;
height: &lt;?= $img[2] ?&gt;px;
overflow: hidden;
text-indent: -9999px;
width: &lt;?= $img[1] ?&gt;px;
}
&lt;?php endif; ?&gt;
&lt;?php endwhile; ?&gt;
&lt;?php endif; ?&gt;
&lt;/style&gt;</pre>
<p>As you can see, on the homepage &#8220;h2#title-&#8221; will be used as selector prefix, while on the every other page it will be &#8220;h1#title-&#8221;.</p>
<h3>Conclusion</h3>
<p>Headline Replacement suffers of some crucial functions. As you can see, the one can be written with no effort so I promise that it will be part of the next update.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/creating-stylesheet-for-headline-replacement/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Headline Replacement 0.1</title>
		<link>http://blog.mariokostelac.com/headline-replacement/</link>
		<comments>http://blog.mariokostelac.com/headline-replacement/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 12:56:34 +0000</pubDate>
		<dc:creator>Mario</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[headline replacement]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp plugin]]></category>

		<guid isPermaLink="false">http://mariokostelac.com/?p=4</guid>
		<description><![CDATA[Headline Replacement is a simple WP plugin that allows you uploading replacement image for post/page title. It is based on Unique Image for Article plugin originally written by Pavol Klacansky, but there are some modifications and improvements. The fact that &#8230; <a href="http://blog.mariokostelac.com/headline-replacement/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Headline Replacement is a simple WP plugin that allows you uploading replacement image for post/page title. It is based on <a href="http://wordpress.org/extend/plugins/headline-image/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/headline-image/?referer=');">Unique Image for Article</a> plugin originally written by Pavol Klacansky, but there are some modifications and improvements.</p>
<p>The fact that you must upload image and then go to Media tab to find the image in order to use it as a headline was annoying. Now it is past, upload and use! No unnecessary steps.</p>
<p><span id="more-4"></span></p>
<p><strong>Update on February 11th, 2012: Plugins is no more supported due to lack of free time.</strong></p>
<p><strong>Update on July 18th, 2010: Plugin is updated and fully compatible with new WordPress.</strong></p>
<p>Only thing you have to do is click on Upload/Insert link in Headline Replacement box as you can see on the images below.</p>
<h3>Installation:</h3>
<ol>
<li>Download plugin from the link below</li>
<li>Upload it in the wp-content/plugins/ directory</li>
<li>Go to Plugins &gt;&gt; Installed page and activate it</li>
<li>Add following code to templace file (in the loop)<br />
<code>&lt;?php if (function_exists('headline_image_show')) headline_image_show(get_the_ID()); ?&gt;</code></li>
</ol>
<h3>Use:</h3>
<p>It is very simple.</p>
<ol>
<li>Upload your picture<br />
<img class="alignnone size-full wp-image-156" title="Headline Replacement plugin" src="http://blog.mariokostelac.com/files/2010/02/step-11.jpg" alt="Headline Replacement dialog box" width="560" height="413" /></li>
<li>Click on &#8220;Use as headline&#8221;</li>
</ol>
<p>That&#8217;s all, if you need just replacing image&#8217;s url, there is a function <code>headline_image_get( get_the_ID() );</code> It returns array whose first element is url.</p>
<h3>Tasks for the future:</h3>
<ul>
<li><span style="text-decoration: line-through;">removing facebook support</span> <a title="New version is released!" href="http://wordpress.org/extend/plugins/headline-replacement/" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/headline-replacement/?referer=');">(0.1.1)</a></li>
<li>migrating all JavaScript code to jQuery</li>
<li><span style="text-decoration: line-through;">adding function for automatic creating stylesheet with replacement styles; now you have to do it on your own</span> (<a title="See how to create stylesheet replacement" href="http://mariokostelac.com/creating-stylesheet-for-headline-replacement/" onclick="pageTracker._trackPageview('/outgoing/mariokostelac.com/creating-stylesheet-for-headline-replacement/?referer=');">temporary solution</a>)</li>
<li>implementing cufon, sIFR and similar techniques (optional)</li>
</ul>
<p><strong>Update</strong>: New version is released, <a title="Download Headline replacament plugin for wordrpress" href="http://wordpress.org/extend/plugins/headline-replacement/" onclick="pageTracker._trackPageview('/outgoing/wordpress.org/extend/plugins/headline-replacement/?referer=');">grab it</a> or update you existing version.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mariokostelac.com/headline-replacement/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
	</channel>
</rss>

