Skip to content

Instantly share code, notes, and snippets.

<?php
class displayentrybytagandslug extends Plugin
{
/**
* Add an author rewrite rule
* @param Array $rules Current rewrite rules
**/
@somefool
somefool / gist:5508897
Created May 3, 2013 12:45
hackign habari for custom rewrite which a has tag/post
this in system/classes/rewriterules
array( 'name' => 'display_entry_tag', 'parse_regex' => '%^(?P<tag>[^/]+)/news/(?P<slug>[^/]+)(?:/page/(?P<page>\d+))?/?$%i', 'build_str' => '{$tag}/news/{$slug}(/page/{$page})', 'handler' => 'UserThemeHandler', 'action' => 'display_post', 'priority' => 100, 'description' => 'Return entry matching specified slug and', 'parameters' => serialize( array( 'require_match' => array('Posts', 'rewrite_match_type'), 'content_type'=>'entry', 'request_types' => array('display_post') ) ) ),
amend route301
'display_entry_by_tag_and_slug' => array( // Wordpress tag and slug based permalink: <tag>/<slug>
'name' => 'display_entry_by_tag_and_slug',
'parse_regex' => '%^(?P<tag>[^/]+)/(?P<slug>[^/]+)(?:/page/(?P<page>\d+))?/?$%i',
'build_str' => '{$tag}/{$slug}(/page/{$page})',
'action' => 'display_entry_tag',