<?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>maratz.com &#187; wordpress</title>
	<atom:link href="http://www.maratz.com/blog/archives/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.maratz.com/blog</link>
	<description>Hypertext rulez™</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:42:10 +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>Display ‘edit’ link in a custom WordPress listing</title>
		<link>http://www.maratz.com/blog/archives/2012/02/04/display-edit-link-in-a-custom-wordpress-listing/</link>
		<comments>http://www.maratz.com/blog/archives/2012/02/04/display-edit-link-in-a-custom-wordpress-listing/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 17:39:15 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/?p=1804</guid>
		<description><![CDATA[Use this snippet inside your custom WordPress posts/pages listing function. &#60;?php if (current_user_can('edit_posts')) { $output = '&#60;a href="' . get_edit_post_link($post->ID) . '"&#62;Edit this post&#60;/a&#62;'; } echo $output; ?&#62;]]></description>
			<content:encoded><![CDATA[<p>Use this snippet inside your custom WordPress posts/pages listing function.</p>
<pre>&#60;?php
if (current_user_can('edit_posts')) {
    $output = '&#60;a href="' . get_edit_post_link($post->ID) . '"&#62;Edit this post&#60;/a&#62;';
}
echo $output;
?&#62;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2012/02/04/display-edit-link-in-a-custom-wordpress-listing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hand-picked related articles in WordPress</title>
		<link>http://www.maratz.com/blog/archives/2011/05/18/hand-picked-related-articles-in-wordpress/</link>
		<comments>http://www.maratz.com/blog/archives/2011/05/18/hand-picked-related-articles-in-wordpress/#comments</comments>
		<pubDate>Wed, 18 May 2011 14:48:37 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/?p=1630</guid>
		<description><![CDATA[When a visitor reads an article she landed to, it’s always good to offer some similar content for further reading. When someone comes to a web site from an external source, say search engine — that usually means she searched for something particular. In that case, if the article is not exactly what she was [...]]]></description>
			<content:encoded><![CDATA[<p>When a visitor reads an article she landed to, it’s always good to offer some similar content for further reading. When someone comes to a web site from an external source, say search engine — that usually means she searched for something particular. In that case, if the article is not exactly what she was looking for, it’s smart to offer an alternative on the same web page.</p>
<p>We recently made an internal study about difference between hand-picked vs. automatic related articles, and as you can already guess — when an article has a hand-picked related content, there’s a greater chance that the visitor will stay, instead of bouncing off to the next Google search result.</p>
<p>This function works with <a href="http://codex.wordpress.org/Custom_Fields">Custom Fields in WordPress</a>, i.e. you’d create Custom Field with “hand_picked_article” for meta name and put the post ID of the content you wan’t to display as a meta value. For more related articles simply add more Custom Fields with the same meta name.</p>
<p>If there’s no hand picked articles, the function will return tag or category related list.</p>
<p><strong><a href="/downloads/cn-related-articles.txt">Download cn-related-articles.php</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2011/05/18/hand-picked-related-articles-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple page or section redirect in WordPress</title>
		<link>http://www.maratz.com/blog/archives/2010/02/09/simple-page-or-section-redirect-in-wordpress/</link>
		<comments>http://www.maratz.com/blog/archives/2010/02/09/simple-page-or-section-redirect-in-wordpress/#comments</comments>
		<pubDate>Tue, 09 Feb 2010 15:47:30 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/?p=1000</guid>
		<description><![CDATA[Recently we had a chance to re-code the old client site: Graniti-Sušec. The site was first developed back in 2003. and was in fact the first commercial (non-personal) site done with web standards in Croatia. At that time I was much more involved with ASP 2.0 and only heard about PHP. But since then — [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we had a chance to re-code the old client site: <a href="http://www.graniti-susec.hr/">Graniti-Sušec</a>. The site was first developed back in 2003. and was in fact the first commercial (non-personal) site done with web standards in Croatia.</p>
<p>At that time I was much more involved with ASP 2.0 and only heard about PHP. But since then — my focus shifted far, far away from ASP, and we decided not to fix the ancient codebase, but to move the backend to WordPress.</p>
<p>With the migration, we had to take care about the new URL scheme. The language part of previous scheme was full-length language name and therefor clumsy. The transition had to be seamless, so we don’t cut-off visitors landing from Google.</p>
<p>The solution is quite simple. All pages are organized as a child pages of two parents: <code>/hr/</code> and <code>/en/</code>. We created two additional first-level pages — <code>/hrvatska/</code> and <code>/english/</code> — and set both pages’ templates to &#8220;Page Redirect&#8221;. This is how it’s done step by step:<span id="more-1000"></span></p>
<h2>Step 1: Create page template</h2>
<p>In your WordPress theme folder create new blank file: <code>page-redirect.php</code>, paste the code below and save it. Keep in mind that there’s no space left before <code>&#60;?php</code> or after <code>?></code> or it might throw you an error.</p>
<p><code>
<pre>&#60;?php
/*
Template Name: Page Redirect
*/
    header('HTTP/1.1 301 Moved Permanently'); 

    $redirect_url = get_post_meta($post->ID, 'redirect_url', true); 

    if (!empty($redirect_url)) {
        header('Location: ' . $redirect_url);
    } else {
        header('Location: /');
    }
?></pre>
<p></code></p>
<h2>Step 2: Add New Page</h2>
<p>Create new page in WordPress (Pages » Add New), and paste the old URL into <em>Permalink</em> field — right below the title field.</p>
<h2>Step 3: Add custom field</h2>
<p>In Custom Fields box, enter new custom field, named <code>redirect_url</code> and set the value to new URL.</p>
<h2>Step 4: Choose page template</h2>
<p>In attribute box (usually on the right hand side), there is Templates drop-down. Select &#8220;Page Redirect&#8221; and hit Publish.</p>
<p>Type the old URL into browser’s address bar, and it should be instantly redirected to your new URL. WordPress will also automagically redirect all child pages, so in my example <code>/english/marble/</code> redirects to <code>/en/marble/</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2010/02/09/simple-page-or-section-redirect-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exclude articles from a category tree on your WordPress homepage</title>
		<link>http://www.maratz.com/blog/archives/2009/07/13/exclude-articles-from-a-category-tree-on-your-wordpress-homepage/</link>
		<comments>http://www.maratz.com/blog/archives/2009/07/13/exclude-articles-from-a-category-tree-on-your-wordpress-homepage/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 11:12:49 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/?p=972</guid>
		<description><![CDATA[A nice way to manage articles visible only to registered users on your WordPress based site is to create one parent category exclusively for those posts and then create sub categories if needed. Once you have the top, subscriber-only category, you will most likely not change it, and therefor you can use its category ID [...]]]></description>
			<content:encoded><![CDATA[<p>A nice way to manage articles visible only to registered users on your <a href="http://wordpress.org/">WordPress</a> based site is to create one parent category exclusively for those posts and then create sub categories if needed.</p>
<p>Once you have the top, subscriber-only category, you will most likely not change it, and therefor you can use its category ID as an argument to construct your query, for instance <code>query_posts(cat=-3)</code>.</p>
<p>This should exclude all the post from the category with ID 3 from the listing. However, this doesn’t exclude posts in child categories, and if we knew all the IDs, we’d expand the call to function like so <code>query_posts(cat=-3,-4,-5)</code>.</p>
<p>In a real life, there are two possible issues. First, it’s a bad practice to rely on IDs for child categories, and the second one is that the default argument syntax <code>cat=-3</code> won’t always work, due to plugins incompatibilities.<span id="more-972"></span></p>
<h2>How to get the child categories IDs?</h2>
<p>We use <code><a href="http://codex.wordpress.org/Function_Reference/get_categories">get_categories</a></code> to get the sub categories. In the following example I first created a string, which you’d use with <code>query_posts(cat=' . $subcat_string)</code>, but aforementioned issues with plugins could require a different argument construction.</p>
<p><code>
<pre>&#60;?php 

    // In this example, the parent category ID is 3
    <strong>$subcategories = get_categories('child_of=3');</strong>

    <strong>$subcat_string = '';
    foreach ($subcategories as $subcat) {
        $subcat_string .= '-' . $subcat->cat_ID . ',';
    }</strong>

    // we also include parent category ID in the list
    <strong>$subcat_string .= '-3';</strong>

    // and then call query_posts
    <strong>query_posts(cat=' . $subcat_string);</strong>

?&#62;</pre>
<p></code></p>
<p>A slightly more advanced (for designers at least) <code>query_posts()</code> call is to use an array for arguments. Quite often where <code>cat=-n</code> doesn’t work this should fix the problem. I believe this is due to plugins incompatibility, but it could be also due to  WordPress itself. Whatever the problem is, this is one way to handle it:</p>
<p><code>
<pre>&#60;?php 

    // Subcategories IDs as an array

    // In this example, the parent category ID is 3
    <strong>$subcategories = get_categories('child_of=3');</strong>

    <strong>$subcat_array = array();
    foreach ($subcategories as $subcat) {
        $subcat_array[] = '-' . $subcat->cat_ID;
    }</strong>

    // we also include parent category ID in the list
    <strong>$subcat_array[] = '-3';</strong>

    // and then call query_posts
    <strong>query_posts(array('category__not_in' => $subcat_array));</strong>

?&#62;</pre>
<p></code> </p>
<h2>Hide posts from the members-only categories</h2>
<p>To check if a visitor is logged-in or not, you’d test <code>$user_ID</code> variable. If the visitor is not a member, we display latest articles sans members-only category. For signed-in users we display the default query results, i.e. all articles from all categories.</p>
<p><code>
<pre>&#60;?php

<strong>if (!$user_ID) {</strong>

     // we created an array of categories to exclude:
     $subcategories = get_categories('child_of=3');
     $subcat_array = array();
     foreach ($subcategories as $subcat) {
         $subcat_array[] = '-' . $subcat->cat_ID;
     }
     $subcat_array[] = '-3';

     // Here, we set $limit for showposts (so it can be redefined via admin if needed)
     <strong>$limit = get_option('posts_per_page');</strong>

     // ... and $paged (to tell WP which page in the Loop is current)
     <strong>$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;</strong> 

     // then populate arguments
     <strong>$args = array(
         'category__not_in' => $subcat_array,
         'paged' => $paged,
         'showposts' => $limit
     );</strong>

     // and call the function
     <strong>query_posts($args);</strong>

     // the general loop code goes here

<strong>}</strong>

?&#62;</pre>
<p></code></p>
<p>Got something to add? Speak up!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2009/07/13/exclude-articles-from-a-category-tree-on-your-wordpress-homepage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress related articles by tags and/or categories</title>
		<link>http://www.maratz.com/blog/archives/2009/06/15/wordpress-related-articles-by-tags-andor-categories/</link>
		<comments>http://www.maratz.com/blog/archives/2009/06/15/wordpress-related-articles-by-tags-andor-categories/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 05:03:05 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[coding/design]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/?p=953</guid>
		<description><![CDATA[Here is a quick code snippet for displaying any given number of articles, related first by tags and optionally from the same category. This is by no means definitive solution, but might come in handy as a quick start. Drop this inside the loop in single.php template, I suggest right behind the the_content() call. See [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick code snippet for displaying any given number of articles, related first by tags and optionally from the same category. This is by no means definitive solution, but might come in handy as a quick start.</p>
<p>Drop this inside <a href="http://codex.wordpress.org/The_Loop"><em>the loop</em></a> in <code>single.php</code> template, I suggest right behind the <a href="http://codex.wordpress.org/Template_Tags/the_content"><code>the_content()</code></a> call. See it in action on the <a href="http://www.gadgeterija.net/2009/06/12/zaradili-300000-dolara-kupovinom-vlastite-glazbe-na-itunesu-ukradenim-karticama/#related-articles">live site</a>.</p>
<p>Use it as a base for more advanced features, or simply c/p. It&#8217;ll work :)</p>
<p><span id="more-953"></span></p>
<p><code>
<pre>&#60;?php

    $max_articles = 7;  // How many articles to display

    echo '&#60;div id="related-articles" class="sidebox"&#62;&#60;h3&#62;Related articles&#60;/h3&#62;&#60;ul&#62;';

    $cnt = 0;

    $article_tags = get_the_tags();
    $tags_string = '';
    if ($article_tags) {
        foreach ($article_tags as $article_tag) {
            $tags_string .= $article_tag-&#62;slug . ',';
        }
    }

    $tag_related_posts = get_posts('exclude=' . $post-&#62;ID . '&#038;numberposts=' . $max_articles . '&#038;tag=' . $tags_string);

    if ($tag_related_posts) {
        foreach ($tag_related_posts as $related_post) {
            $cnt++;
            echo '&#60;li class="child-' . $cnt . '"&#62;';
            echo '&#60;a href="' . get_permalink($related_post-&#62;ID) . '"&#62;';
            echo $related_post-&#62;post_title . '&#60;/a&#62;&#60;/li&#62;';
        }
    }

    // Only if there's not enough tag related articles,
    // we add some from the same category

    if ($cnt &#60; $max_articles) {

        $article_categories = get_the_category($post-&#62;ID);
        $category_string = '';
        foreach($article_categories as $category) {
            $category_string .= $category-&#62;cat_ID . ',';
        }

        $cat_related_posts = get_posts('exclude=' . $post-&#62;ID . '&#038;numberposts=' . $max_articles . '&#038;category=' . $category_string);

        if ($cat_related_posts) {
            foreach ($cat_related_posts as $related_post) {
                $cnt++;
                if ($cnt &#62; $max_articles) break;
                echo '&#60;li class="child-' . $cnt . '"&#62;';
                echo '&#60;a href="' . get_permalink($related_post-&#62;ID) . '"&#62;';
                echo $related_post-&#62;post_title . '&#60;/a&#62;&#60;/li&#62;';
            }
        }
    }

    echo '&#60;/ul&#62;&#60;/div&#62;';

?&#62;</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2009/06/15/wordpress-related-articles-by-tags-andor-categories/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2 Balanced WordPress Themes</title>
		<link>http://www.maratz.com/blog/archives/2008/01/22/2-balanced-wordpress-themes/</link>
		<comments>http://www.maratz.com/blog/archives/2008/01/22/2-balanced-wordpress-themes/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 12:57:09 +0000</pubDate>
		<dc:creator>Marko Dugonjić</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.maratz.com/blog/archives/2008/01/22/2-balanced-wordpress-themes/</guid>
		<description><![CDATA[The first post in this year (better late, than never) and I present you 2 (that’s right: two) brand new web logs by my two fellow colleagues — Marko Kršul (the creative) and Tomaš Trkulja (the methodic). I was more than happy to contribute in the development of these two beautiful WordPress themes, spiritually named [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.maratz.com/img/2008/jan/dudikoff2.jpg" alt="" width="420" height="210" /></p>
<p>The first post in this year (better late, than never) and I present you 2 (that’s right: two) brand new web logs by my two fellow colleagues — <a href="http://www.teribl.org/">Marko Kršul</a> (the creative) and <a href="http://zytzagoo.net/blog/">Tomaš Trkulja</a> (the methodic).</p>
<p>I was more than happy to contribute in the development of these two beautiful WordPress themes, spiritually named <strong>Balance White</strong> and <strong>Balance Black</strong>. The White was deployed first on <a href="http://www.adriamedia.hr/">our company’s</a> <a href="http://www.croportal.net/">flagship project’s</a> <a href="http://www.croportal.hr/lab/">development blog</a> in it’s original setup and <del>Dudikoff and Roseanne</del> <ins datetime="2008-0-23T17:8:59--1:00">(link removed for offending content :p)</ins> have been customized later on. <ins datetime="2008-0-23T17:5:22--1:00">(<strong>Ed’s note:</strong> Dudikoff and Roseanne is not a WordPress theme, it’s customized  version of Balance White.)</ins></p>
<p>Anyway, download <a href="http://www.maratz.com/downloads/balance-white.zip" onclick="javascript: pageTracker._trackPageview('/downloads/balance-white.zip');">Balance White</a> or <a href="http://www.maratz.com/downloads/balance-black.zip" onclick="javascript: pageTracker._trackPageview('/downloads/balance-black.zip');">Balance Black</a> and if you care, let us know what do you think.</p>
<h2>Sample sites:</h2>
<ul>
<li><a href="http://www.croportal.hr/lab/">Croportal Dev Blog</a></li>
<li><a href="http://www.zytzagoo.net/blog/">Zytzagoo’s Den</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.maratz.com/blog/archives/2008/01/22/2-balanced-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
	</channel>
</rss>

