<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Moha</title>
    <description></description>
    <link>https://mohanjith.net/</link>
    <atom:link href="https://mohanjith.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sat, 30 May 2026 13:17:53 +0000</pubDate>
    <lastBuildDate>Sat, 30 May 2026 13:17:53 +0000</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>Taming the Unpredictable: How an AGENTS.md File Keeps Your AI Team in Check</title>
        <description>&lt;p&gt;Building software with a team of AI agents feels a bit like managing a group of incredibly eager, brilliant, but wildly unpredictable junior developers. They work at lightning speed and possess vast knowledge, but left to their own devices, they tend to lose the plot. Give an agent a simple feature request, and without strict boundaries, it might try to rewrite your entire frontend or introduce a massive relational database you don’t need.&lt;/p&gt;

&lt;p&gt;I recently hit this friction point while building Pouta CMS. Because Pouta relies strictly on a serverless architecture within the Cloudflare ecosystem—specifically leveraging Pages, R2 storage, and Worker AI—there is zero room for architectural drift. Furthermore, maintaining the boundary between the GPLv3 open-source core and the SaaS Pro tier is critical.&lt;/p&gt;

&lt;p&gt;I needed a way to dictate exactly how my Lean AI team interacts with the repository. The solution was surprisingly simple: an &lt;code&gt;AGENTS.md&lt;/code&gt; file.&lt;/p&gt;

&lt;h2 id=&quot;dictating-the-machine&quot;&gt;Dictating the Machine&lt;/h2&gt;

&lt;p&gt;An &lt;code&gt;AGENTS.md&lt;/code&gt; file acts as the single source of truth for any AI agent touching your codebase. Think of it as the ultimate onboarding document. When an agent enters the repository, it reads this file to understand the hard technical constraints, the formatting standards, and the architectural philosophy of the project.&lt;/p&gt;

&lt;p&gt;However, writing a comprehensive rulebook manually is tedious and prone to human oversight. Instead of writing it myself, I decided to let the machine dictate to the machine.&lt;/p&gt;

&lt;h2 id=&quot;generating-the-rules-with-agy&quot;&gt;Generating the Rules with &lt;code&gt;agy&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;To create the perfect &lt;code&gt;AGENTS.md&lt;/code&gt;, I used Antigravity (&lt;code&gt;agy&lt;/code&gt;). The premise was straightforward: an AI agent is only as good as its context.&lt;/p&gt;

&lt;p&gt;Instead of typing out isolated instructions, I fed &lt;code&gt;agy&lt;/code&gt; my existing, carefully crafted documentation. I provided:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;My input on the desired workflow.&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;*The **&lt;code&gt;README.md&lt;/code&gt; (The *What&lt;/em&gt; and the &lt;em&gt;Why&lt;/em&gt; of Pouta CMS).&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;*The **&lt;code&gt;ARCHITECTURE.md&lt;/code&gt; (The *How&lt;/em&gt;—detailing the strict serverless approach).
By synthesizing these documents, &lt;code&gt;agy&lt;/code&gt; grasped the exact boundary conditions of the project. It understood that we don’t just write code; we write code specifically optimized for Cloudflare workers and R2. It understood the separation of concerns between the open-source and premium tiers.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;what-actually-goes-into-agentsmd&quot;&gt;What Actually Goes Into &lt;code&gt;AGENTS.md&lt;/code&gt;?&lt;/h2&gt;

&lt;p&gt;The resulting file generated by &lt;code&gt;agy&lt;/code&gt; established non-negotiable rules for the rest of my Lean AI team. While the specifics are tailored deeply to Pouta, the core directives look something like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Infrastructure Supremacy:&lt;/strong&gt; All storage solutions must default to Cloudflare R2. Do not suggest or implement traditional relational databases or alternative cloud providers.
&lt;strong&gt;License Awareness:&lt;/strong&gt; Any code modifications must respect the GPLv3 license of the core project. Features designated for the SaaS tier must be cleanly separated and not leaked into the open-source repository.
&lt;strong&gt;Lean Execution:&lt;/strong&gt; Do not introduce heavy external dependencies unless absolutely necessary. Rely on native web APIs and serverless patterns.&lt;/p&gt;

&lt;h2 id=&quot;the-result-a-calibrated-sdlc&quot;&gt;The Result: A Calibrated SDLC&lt;/h2&gt;

&lt;p&gt;Implementing &lt;code&gt;AGENTS.md&lt;/code&gt; completely transformed my Software Development Life Cycle.&lt;/p&gt;

&lt;p&gt;The immediate benefit was a drastic reduction in AI hallucinations. I no longer have to spend my mental energy micromanaging the agents’ architectural choices. When I ask an agent to draft a new content management feature, it inherently knows to hook it up to R2 storage rather than asking me how I want to store the data.&lt;/p&gt;

&lt;p&gt;Treating your AI agents like a real engineering team means providing them with the structural context they need to succeed. By using &lt;code&gt;agy&lt;/code&gt; to synthesize my project’s architecture into an &lt;code&gt;AGENTS.md&lt;/code&gt; file, my Lean AI team is finally pulling in the exact same direction.&lt;/p&gt;

</description>
        <pubDate>Sat, 30 May 2026 00:00:00 +0000</pubDate>
        <link>https://mohanjith.net/blog/2026/05/taming-the-unpredictable-how-an-agentsmd-file-keeps-your-ai-team-in-check.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2026/05/taming-the-unpredictable-how-an-agentsmd-file-keeps-your-ai-team-in-check.html</guid>
        
        <category>serverless</category>
        
        <category>ai</category>
        
        <category>cloudflare</category>
        
        
        <category>software-development</category>
        
      </item>
    
      <item>
        <title>The Ultimate Zero-Friction Blogging Experience: Pouta and Jekyll&apos;s Perfect Pairing</title>
        <description>&lt;p&gt;There is no feeling quite like building a tool from scratch, plugging it into your own workflow, and watching it completely exceed your expectations. Yesterday, I officially finished building &lt;strong&gt;Pouta headless CMS&lt;/strong&gt;. Today, I paired it with &lt;strong&gt;Jekyll&lt;/strong&gt; for my own blog, and I am absolutely blown away.&lt;/p&gt;

&lt;p&gt;When you build a headless CMS, you have a vision of how it &lt;em&gt;should&lt;/em&gt; work. Seeing it actually deliver that reality in less than 24 hours is a massive win. Here is why I am incredibly hyped:&lt;/p&gt;

&lt;h3 id=&quot;-unbelievable-speed&quot;&gt;⚡ Unbelievable Speed&lt;/h3&gt;

&lt;p&gt;By pairing Pouta’s streamlined API delivery with Jekyll’s static site generation, the performance is unreal. There are no heavy databases dragging things down or clunky queries holding back load times.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;The site doesn’t just load fast; it &lt;strong&gt;instantly snaps into existence&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;Lightweight, optimized, and built for modern web performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;️-zero-friction-blogging&quot;&gt;✍️ Zero-Friction Blogging&lt;/h3&gt;

&lt;p&gt;I built Pouta because I wanted a cleaner way to manage content, but using it with Jekyll has made blogging feel effortless.&lt;/p&gt;

&lt;p&gt;“The distance between having an idea and seeing it live on my site is now practically zero.”&lt;/p&gt;

&lt;p&gt;The interface gives me a distraction-free environment to just &lt;em&gt;write&lt;/em&gt;. Pouta handles the content architecture beautifully, hands it off to Jekyll, and the deployment is seamless. No clunky visual editors, no formatting nightmares—just pure creation.&lt;/p&gt;

&lt;h3 id=&quot;️-the-ultimate-developer-high&quot;&gt;🛠️ The Ultimate Developer High&lt;/h3&gt;

&lt;p&gt;There is a unique satisfaction in using your own tool to solve your own problems. No more fighting bloated, plugin-heavy legacy systems. This setup is secure by default, infinitely scalable, and exactly as lean as I wanted it to be.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Verdict:&lt;/strong&gt; Building Pouta was worth every single line of code. Seeing it make my own writing workflow this fast and this much fun is the ultimate validation. The headless future is here, and I’m proud to have built a piece of it!&lt;/p&gt;

</description>
        <pubDate>Thu, 28 May 2026 00:00:00 +0000</pubDate>
        <link>https://mohanjith.net/blog/2026/05/the-ultimate-zero-friction-blogging-experience-pouta-and-jekylls-perfect-pairing.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2026/05/the-ultimate-zero-friction-blogging-experience-pouta-and-jekylls-perfect-pairing.html</guid>
        
        <category>pouta</category>
        
        <category>jekyll</category>
        
        <category>headless-cms</category>
        
        
        <category>blogging</category>
        
      </item>
    
      <item>
        <title>Sri Lankan style Chinese fried rice recipe</title>
        <description>&lt;h2 id=&quot;ingredients&quot;&gt;Ingredients&lt;/h2&gt;

&lt;h3 id=&quot;chicken&quot;&gt;Chicken&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;400g of chicken cut into small pieces (kana)&lt;/li&gt;
  &lt;li&gt;1 red chilli thinly sliced (punainen chili)&lt;/li&gt;
  &lt;li&gt;1/2 tea spoon of baking soda (ruokasoodaa)&lt;/li&gt;
  &lt;li&gt;1 tea spoons of salt (suolaa)&lt;/li&gt;
  &lt;li&gt;1 tea spoon of corn flour (maissijauhoa)&lt;/li&gt;
  &lt;li&gt;1 table spoons of cooking oil (rypsiöljy)&lt;/li&gt;
  &lt;li&gt;1 tea spoon of Indonesian sweet soy sauce (ketjap manis)&lt;/li&gt;
  &lt;li&gt;1/2 tea spoon of ginger crushed or thinly sliced (inkivääri)&lt;/li&gt;
  &lt;li&gt;1 cloves of garlic crushed or thinly sliced (valkosipuli)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;rice&quot;&gt;Rice&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;3 dl of basmati or jasmine rice (basmati tai jasmiini riisi)&lt;/li&gt;
  &lt;li&gt;6 dl of water (vesi)&lt;/li&gt;
  &lt;li&gt;1 tea spoon of chicken concentrate (kana fondi)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;eggs&quot;&gt;Eggs&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;4 eggs (kananmuna)&lt;/li&gt;
  &lt;li&gt;2 tea spoons of pepper (pippuri)&lt;/li&gt;
  &lt;li&gt;1 tea spoon of salt (suolaa)&lt;/li&gt;
  &lt;li&gt;1 table spoons of cooking oil (rypsiöljy)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;stir-fry&quot;&gt;Stir fry&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;2 table spoons of cooking oil (rypsiöljy)&lt;/li&gt;
  &lt;li&gt;1/2 tea spoon of ginger crushed or thinly sliced (inkivääri)&lt;/li&gt;
  &lt;li&gt;1 cloves of garlic crushed or thinly sliced (valkosipuli)&lt;/li&gt;
  &lt;li&gt;2 large carrots cut Julienne (porkkana)&lt;/li&gt;
  &lt;li&gt;1 thin leek sliced (purjosipuli)&lt;/li&gt;
  &lt;li&gt;2 tea spoons of salty soy sauce (soijakastike)&lt;/li&gt;
  &lt;li&gt;1 tea spoon of salt if needed to taste (suolaa)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;preperation&quot;&gt;Preperation&lt;/h2&gt;

&lt;h3 id=&quot;rice-1&quot;&gt;Rice&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Prepare the rice for 4 portions as instructed in the package and put it aside. You can add 1 tea spoon of chicken concentrate but remember to reduce any salt accordingly. Usually rice to water ratio is 1:2.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;chicken-1&quot;&gt;Chicken&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;Put the chicken in a bowl and add 1 tea spoon of salt, 1 tea spoon of corn flour, 1 tea spoon of sweet soy sauce, 1/2 tea spoon of banking soda and the thinly sliced chilli.&lt;/li&gt;
  &lt;li&gt;Mix thoroughly.&lt;/li&gt;
  &lt;li&gt;Put it in the fridge for around 20 minutes.&lt;/li&gt;
  &lt;li&gt;Once the chicken is ready. Put 1 table spoon of oil into a hot wok.&lt;/li&gt;
  &lt;li&gt;Then add half the garlic and ginger to that wok and let it fry for few seconds.&lt;/li&gt;
  &lt;li&gt;Then add the chicken. Leave the chicken flat on the wok for 2 minutes.&lt;/li&gt;
  &lt;li&gt;Then turn the chicken other way around. We want to make the chicken little brown but not burn it.&lt;/li&gt;
  &lt;li&gt;Put the cooked chicken into a clean bowl.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;eggs-1&quot;&gt;Eggs&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Beat the 4 eggs lightly with 1 tea spoon of salt and 2 tea spoons of pepper.&lt;/li&gt;
  &lt;li&gt;Add 1 table spoon of oil to the hot wok and then add the eggs and scramble them until the eggs are little brown outside.&lt;/li&gt;
  &lt;li&gt;Put the cooked eggs into a clean bowl.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;stir-fry-1&quot;&gt;Stir fry&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Add 2 table spoons of oil to the hot wok.&lt;/li&gt;
  &lt;li&gt;Add the garlic and ginger. Let it fry for few seconds.&lt;/li&gt;
  &lt;li&gt;Then add carrots and salty soy sauce and mix well.&lt;/li&gt;
  &lt;li&gt;Cover and let it cook for a minute.&lt;/li&gt;
  &lt;li&gt;Then add the leeks and cover mix well.&lt;/li&gt;
  &lt;li&gt;Cover and cook for 30s.&lt;/li&gt;
  &lt;li&gt;Then add the rice and mix well with the vegetables.&lt;/li&gt;
  &lt;li&gt;Then add chicken and scrambled eggs and mix well.&lt;/li&gt;
  &lt;li&gt;Let it sit on the stove for 30s but make sure nothing burns.&lt;/li&gt;
  &lt;li&gt;Enjoy!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;I like food with less salt. You can add salt wherever mentioned as you prefer.&lt;/li&gt;
  &lt;li&gt;For the stir fry you can add bean sprouts, broccoli, bamboo shoots if you have them.&lt;/li&gt;
  &lt;li&gt;Serve with sweet chilli sauce or hot chilli sauce if you can’t find Chinese chilli paste.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Sun, 16 Nov 2014 22:37:14 +0000</pubDate>
        <link>https://mohanjith.net/blog/2014/11/sri-lankan-style-chinese-fried-rice.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2014/11/sri-lankan-style-chinese-fried-rice.html</guid>
        
        <category>chicken</category>
        
        <category>china</category>
        
        <category>chinese</category>
        
        <category>sri lanka</category>
        
        <category>sri lankan</category>
        
        
        <category>Food</category>
        
        <category>Recipe</category>
        
      </item>
    
      <item>
        <title>HD Satellite TV finally in Sri Lanka</title>
        <description>&lt;p&gt;Dialog TV finally launched HD TV in their Satellite TV subscribers. I have been asking Dialog for HD TV for more than a year, so it was only fair I signed up gave it a shot.&lt;/p&gt;

&lt;p&gt;Signing up was a breeze, no calls to the customer service hotline; a simple SMS to 679 and I was signed up. Then I had to wait for the decoder to be delivered, but that took less than 24 hours (18 hours may be) and it came with a technician :D. Big thumbs up to Dialog for quick response.&lt;/p&gt;
&lt;h3&gt;Channels&lt;/h3&gt;
&lt;p&gt;I know the HD subscription is too high for too few channels, but considering the fact that in a tiny island everything new is supposed to be expensive I’m not complaining. However more channels would be nice. I would personally like to see the following channels being offered in HD.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Discovery Channel&lt;/li&gt;
	&lt;li&gt;Discovery Science&lt;/li&gt;
	&lt;li&gt;HBO Bouquet&lt;/li&gt;
	&lt;li&gt;KidsCo&lt;/li&gt;
	&lt;li&gt;The Buddhist TV (This is a long shot, but one can ask)&lt;/li&gt;
	&lt;li&gt;Ten Action&lt;/li&gt;
	&lt;li&gt;Warner TV&lt;/li&gt;
	&lt;li&gt;VH1&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Decoder&lt;/h3&gt;
&lt;p&gt;I got a OHS1720IR decoder which comes with HDMI, RCA and S/PDIF ports (I’m not counting the USB port used by the flash drive used for PVR). I’m glad Dialog finally has a decoder which support HDMI Video and Audio. Did I tell you it also supports Dolby Digital Audio.&lt;/p&gt;

&lt;p&gt;PVR function is very handy, now my mom doesn’t have to complain about missing programs on The Buddhist TV :) When you sign up for HD Pack you get PVR for free. However the catch is you can’t record a SD channel and watch a HD channel or record a HD channel and watch any other channel. But that’s better than what we had before, so I’m not complaining.&lt;/p&gt;

&lt;p&gt;However while preparing for the blog post I found a bug in the decoder firmware. If I take a screen capture of a HD channel remote stops working until you have to restart the DVR. But this is a borderline use case, so not a show stopper. My guess a memory leak in screen capture. It would be nice if Dialog could release a fix soon.&lt;/p&gt;

&lt;p&gt;Also did I tell you the decoder support 1080p even though Dialog TV content is only 1080i. So the menus look better than the content itself. I hope we will soon see 1080p content ;)&lt;/p&gt;
&lt;h3&gt;Picture Quality&lt;/h3&gt;
&lt;p&gt;I guess I kept you waiting long enough before I showed you how good HD TV on Dialog TV looks. Both HD channels and SD channels look so much better on this decoder. I couldn’t find any flaws with the picture quality. All these were captured with the built in screen capture. Sizes will differ based on what what the source quality was. Please click through and checkout the quality in all it’s glory.&lt;/p&gt;
&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;

&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;
&lt;p&gt;I might decide to upload a video shot with the stunning HD camera on my Samsung Galaxy Nexus to show you how good the video looks with the new decoder and show off the new HD Channels. So remember to subscribe to my RSS feed and check back in a few days :)&lt;/p&gt;
</description>
        <pubDate>Fri, 22 Jun 2012 16:11:26 +0000</pubDate>
        <link>https://mohanjith.net/blog/2012/06/hd-satellite-tv-finally-in-sri-lanka.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2012/06/hd-satellite-tv-finally-in-sri-lanka.html</guid>
        
        <category>Dialog</category>
        
        <category>HDMI</category>
        
        <category>HDTV</category>
        
        <category>TV</category>
        
        
        <category>Dialog</category>
        
      </item>
    
      <item>
        <title>WYSIWYG editor in your WordPress theme or plugin</title>
        <description>&lt;p&gt;Prior to WordPress 3.3 adding WYSIWYG editor to a frontend page meant you had almost reinvent the wheel. In WordPress 3.3 wp_editor was introduced which made developer/designer’s life whole lot easier. Now you can add the same editor used when you type up a post can be added anywhere in your theme or plugin (frontend or backend).&lt;/p&gt;

&lt;p&gt;I stumbled across this function by accident when I was checking why the WYSIWYG editor was not working on one of my plugins on WordPress 3.3 . You also can allow users to  upload images if the user has necessary capabilities using the editor wp_editor adds.&lt;/p&gt;

&lt;p&gt;Read all about it on the WordPress &lt;a href=&quot;http://codex.wordpress.org/Function_Reference/wp_editor&quot;&gt;Codex&lt;/a&gt; . Hope someone will find it useful.&lt;/p&gt;
</description>
        <pubDate>Wed, 14 Dec 2011 14:18:18 +0000</pubDate>
        <link>https://mohanjith.net/blog/2011/12/wysiwyg-editor-in-your-wordpress-theme-or-plugin.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2011/12/wysiwyg-editor-in-your-wordpress-theme-or-plugin.html</guid>
        
        <category>3.3</category>
        
        <category>new function</category>
        
        <category>WordPress</category>
        
        
        <category>WordPress</category>
        
      </item>
    
      <item>
        <title>WordPress How To: Monthly,Yearly and Daily Archives for Custom Post Types</title>
        <description>&lt;p&gt;For a plugin I was creating I needed Yearly and Monthly archives with my own slug. Even after setting the rewrite rules it was not working. After much debugging and several hours later I finally figured it out. I’ll explain how you could do the same bellow.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Spoiler Alert:&lt;/strong&gt; For the impatient, it was as simple as removing the old rules that are not setting the post type before adding the new rules :)&lt;/p&gt;

&lt;p&gt;I’m going to assume that you have already familiar with Custom Post types. If you are not read http://codex.wordpress.org/Post_Types and then come back. Most important are Step 5 and Step 6. Other steps are typical for any plugin or theme using custom post types.&lt;/p&gt;

&lt;p&gt;Step 1: Register the post type
Read more about registering custom post types at
register_post_type( ‘my_class’,
array(
‘public’ =&amp;gt; true,
…
‘has_archive’ =&amp;gt; true,
)
);
Step 2: Add rewrite tags and permalink structure
$event_structure = ‘/events/%year%/%monthnum%/%my_class%’;
$wp_rewrite-&amp;gt;add_rewrite_tag(“%my_class%”, ‘(.+?)’, “my_class=”);
$wp_rewrite-&amp;gt;add_permastruct(‘my_class’, $event_structure, false);
Step 3: Add &lt;code&gt;post_type_link&lt;/code&gt; and &lt;code&gt;rewrite_rules_array&lt;/code&gt; filters
add_filter(‘rewrite_rules_array’, ‘my_class_add_rewrite_rules’);
add_filter(‘post_type_link’, ‘my_class_post_type_link’, 10, 3);
Step 4: Return a proper permalink
function my_class_post_type_link($permalink, $post_id, $leavename) {
$post = get_post($post_id);&lt;/p&gt;

&lt;p&gt;$rewritecode = array(
‘%my_class%’,
‘%year%’,
‘%monthnum%’
);&lt;/p&gt;

&lt;p&gt;if ($post-&amp;gt;post_type == ‘my_class’ &amp;amp;&amp;amp; ‘’ != $permalink) {&lt;/p&gt;

&lt;p&gt;$ptype = get_post_type_object($post-&amp;gt;post_type);&lt;/p&gt;

&lt;p&gt;$start = time();
$end = time();&lt;/p&gt;

&lt;p&gt;$meta = get_post_custom($post-&amp;gt;ID);
// This is where I store when the class starts
if (isset($meta[“my_class_start”]) &amp;amp;&amp;amp; isset($meta[“my_class_start”])) {
$start = strtotime($meta[“my_class_start”]);
}&lt;/p&gt;

&lt;p&gt;$year = date(‘Y’, $start);
$month = date(‘m’, $end);&lt;/p&gt;

&lt;p&gt;$rewritereplace = array(
($post-&amp;gt;post_name == “”)?$post-&amp;gt;id:$post-&amp;gt;post_name,
$year,
$month,
);
$permalink = str_replace($rewritecode, $rewritereplace, $permalink);
} else {
// if they’re not using the fancy permalink option
}&lt;/p&gt;

&lt;p&gt;return $permalink;
}
Step 5: Add rewrite rules
function my_class_add_rewrite_rules($rules){
$new_rules = array();&lt;/p&gt;

&lt;p&gt;// This is the important bit, unsetting the rules
unset($rules[‘classes/({4})/({1,2})/?$’]);
unset($rules[‘classes/({4})/?$’]);&lt;/p&gt;

&lt;p&gt;$new_rules[‘classes/({4})/?$’] = ‘index.php?year=$matches&amp;amp;post_type=incsub_event’;
$new_rules[‘classes/({4})/({1,2})/?$’] = ‘index.php?year=$matches&amp;amp;monthnum=$matches&amp;amp;post_type=incsub_event’;
$new_rules[‘classes/({4})/({2})/(.+?)/?$’] = ‘index.php?year=$matches&amp;amp;monthnum=$matches&amp;amp;incsub_event=$matches’;&lt;/p&gt;

&lt;p&gt;return array_merge($new_rules, $rules);
}
Step 6: Don’t forget to flush
add_action(‘option_rewrite_rules’, ‘my_class_check_rewrite_rules’);
function my_class_check_rewrite_rules($value) {
global $wp_rewrite;&lt;/p&gt;

&lt;p&gt;//prevent an infinite loop
if ( ! post_type_exists( ‘incsub_event’ ) )
return;&lt;/p&gt;

&lt;p&gt;if (!is_array($value))
$value = array();&lt;/p&gt;

&lt;p&gt;$array_key = ‘events/({4})/?$’;
if ( !array_key_exists($array_key, $value) ) {
$wp_rewrite-&amp;gt;flush_rules();
}
$array_key = ‘events/({4})/({1,2})/?$’;
if ( !array_key_exists($array_key, $value) ) {
$wp_rewrite-&amp;gt;flush_rules();
}
$array_key = ‘events/({4})/({1,2})/(.+?)/?$’;
if ( !array_key_exists($array_key, $value) ) {
$wp_rewrite-&amp;gt;flush_rules();
}
}
That’s it. Most important steps are Step 5 and Step 6&lt;/p&gt;
</description>
        <pubDate>Tue, 25 Oct 2011 18:05:34 +0000</pubDate>
        <link>https://mohanjith.net/blog/2011/10/wordpress-how-to-monthlyyearly-and-daily-archives-for-custom-post-types.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2011/10/wordpress-how-to-monthlyyearly-and-daily-archives-for-custom-post-types.html</guid>
        
        
        <category>Tutorial</category>
        
        <category>WordPress</category>
        
      </item>
    
      <item>
        <title>Days of the Week</title>
        <description>&lt;p&gt;I know it’s little late, but I got tired of all the hate towards Rebecca Black because her single is about Friday. I took the liberty to come up with a list of music videos of every single day of the week. Have fun watching and listening to them. All the other artist deserve the hate Rebecca Black got :D&lt;/p&gt;
</description>
        <pubDate>Sat, 09 Apr 2011 19:39:34 +0000</pubDate>
        <link>https://mohanjith.net/blog/2011/04/days-of-the-week.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2011/04/days-of-the-week.html</guid>
        
        <category>Friday</category>
        
        <category>Meme</category>
        
        <category>music</category>
        
        <category>Rebecca Black</category>
        
        
        <category>Meme</category>
        
      </item>
    
      <item>
        <title>Dialog Axiata APN update for Android mobiles</title>
        <description>&lt;p&gt;I was annoyed that I had to configure the APN every time I either installed a OS upgrade after a wipe or switched SIMs on my HTC Hero. I went and composed a complete list of APNs for &lt;a href=&quot;http://dialog.lk/&quot;&gt;Dialog Axiata&lt;/a&gt;. You just need to copy it to your Android based phone and boot into recover mode and flash the zip file. I hope to post in more detail soon, that’s it for now.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;/assets/images/uploads/2010/11/dialog-apns-0.1-signed.zip&quot;&gt;dialog-apns-0.1-signed&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Tue, 23 Nov 2010 19:51:13 +0000</pubDate>
        <link>https://mohanjith.net/blog/2010/11/dialog-axiata-apn-update-for-android-mobiles.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2010/11/dialog-axiata-apn-update-for-android-mobiles.html</guid>
        
        <category>3G</category>
        
        <category>Android</category>
        
        <category>APN</category>
        
        <category>Dialog</category>
        
        
        <category>3G</category>
        
        <category>Android</category>
        
        <category>Dialog</category>
        
      </item>
    
      <item>
        <title>Blogging from the iPad</title>
        <description>&lt;p&gt;WordPress for iOS is not very handy to blog, specially if it has lot of text but it’s perfect on iPad. This post is made from the iPad and I’m loving it. May be I should start a separate blog for it :-?&lt;/p&gt;

&lt;p&gt;Bottom line is WordPress for iOS is a win on the iPad. Since blogging became so much easier, expect more blog posts :D&lt;/p&gt;
</description>
        <pubDate>Mon, 13 Sep 2010 19:25:58 +0000</pubDate>
        <link>https://mohanjith.net/blog/2010/09/blogging-from-the-ipad.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2010/09/blogging-from-the-ipad.html</guid>
        
        <category>Apple</category>
        
        <category>iPad</category>
        
        <category>WordPress</category>
        
        
        <category>WordPress</category>
        
      </item>
    
      <item>
        <title>Password reuse</title>
        <description>&lt;p&gt;&lt;img class=&quot;aligncenter&quot; title=&quot;Easiest way to crack a password&quot; src=&quot;http://imgs.xkcd.com/comics/password_reuse.png&quot; alt=&quot;&quot; width=&quot;480&quot; height=&quot;1189&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Mon, 13 Sep 2010 05:51:03 +0000</pubDate>
        <link>https://mohanjith.net/blog/2010/09/password-reuse.html</link>
        <guid isPermaLink="true">https://mohanjith.net/blog/2010/09/password-reuse.html</guid>
        
        <category>comic</category>
        
        
        <category>comic</category>
        
      </item>
    
  </channel>
</rss>