Skip to content

Instantly share code, notes, and snippets.

View makbeta's full-sized avatar

makbeta makbeta

View GitHub Profile
@makbeta
makbeta / category-nesting.html
Last active December 11, 2015 06:39
Luminate CMS: Convert fake 2 level categories into a nested list. The code assumes the fake 2 level categories labels have format: Parent, Parent > Child1, Parent > Child2 & names have format: parent, parent-child. If the label is properly encoded then match against '.*gt;.*' (note: matching against '.*>.*' will not work). If label does not h…
<t:data name="categories" class="categories" parent="/tags" />
<t:set id="lastCat" value="''" />
<t:set id="valueToRemove" value="''" />
<ul>
<t:list id="categories">
<t:if test="!matches(lastCat, '.*gt;.*') && !matches(label, '.*gt;.*') && lastCat != ''">
</li>
</t:if>
<t:if test="matches(lastCat, '.*gt;.*') && !matches(label, '.*gt;.*')">
</ul></li>
@makbeta
makbeta / rich-meta-description.html
Created January 31, 2013 18:11
Luminate CMS: Rich text description as meta description
<t:if test="isNull(description)">
<meta name="Description" content="Default Meta description should appear here" />
</t:if>
<t:else>
<t:set id="mydesc" value="toText(description, '') " />
<t:set id="mydesc" value="escapeQuotes(mydesc) " />
<t:set id="mydesc" value="replace(mydesc, '\\"', '&quot;')" />
<t:set id="mydesc" value="replace(mydesc, '\\', '&#39;')" />
<meta name="Description" content="${mydesc}" />
</t:else>
@makbeta
makbeta / conditional-navigation.html
Created February 6, 2013 02:26
Luminate CMS: Main navigation with active state CLO & CMS conditionals
<ul class="navigation">
[[?[[S8]]::/who-we-are/::<li class="selected">::<li>]]<a href="http://www.mydomain.com/who-we-are/">Who we are</a> </li>
[[?[[S8]]::/what-we-do/::<li class="selected">::<li>]]<a href="http://www.mydomain.com/what-we-do/">What we do</a> </li>
[[?[[S8]]::/where-we-work/::<li class="selected">::<li>]]<a href="http://www.mydomain.com/where-we-work/">Where we work</a> </li>
[[?[[S8]]::/what-you-can-do/::<li class="selected">::<li>]]<a href="http://www.mydomain.com/what-you-can-do/">What you can do</a> </li>
</ul>
<ul class="navigation">
<t:if test="matches(path,'.*/who-we-are/.*')"><li class="selected"></t:if><t:else><li></t:else><a href="http://www.mydomain.com/who-we-are/">Who we are</a> </li>
<t:if test="matches(path,'.*/what-we-do/.*')"><li class="selected"></t:if><t:else><li></t:else><a href="http://www.mydomain.com/what-we-do/">What we do</a> </li>
@makbeta
makbeta / clo-title.html
Last active May 4, 2017 16:28
Luminate Online: Render title based on application.
[[?x1x2x25x::x[[S4]]x::<h1>Events</h1>::]]
[[?x6x8x::x[[S4]]x::<h1>Store</h1>::]]
[[?x[[S4]]x::x5x::<h1>Tell a Friend</h1>::]]
[[?x[[S4]]x::x9x::<h1>Donate</h1>::]]
[[?x[[S4]]x::x41x::<h1>eCards</h1>::]]
[[?x[[S4]]x::x81x::<h1>Your Profile</h1>::]]
[[?x[[S4]]x::x82x::<h1>Your Interests</h1>::]]
[[?x[[S4]]x::x83x::<h1>Unsubscribe Options</h1>::]]
[[?x[[S4]]x::x85x::<h1>Preferences</h1>::]]
[[?x[[S4]]x::x186x::<h1>Service Center</h1>::]]
@makbeta
makbeta / clo-body-class.html
Last active October 18, 2018 14:33
Luminate Online: body class based on application
class="[[T9:
[[?x[[S4]]x::x41x::ecards::]]
[[?x[[S4]]x::x81x::profile::]]
[[?x[[S4]]x::x82x::interests::]]
[[?x[[S4]]x::x83x::unsubscribe::]]
[[?x[[S4]]x::x85x::preferences::]]
[[?x[[S4]]x::x5x::tell-a-friend::]]
[[?x[[S4]]x::x186x::service-center::]]
[[?x[[S4]]x::x10x::user-login [[?x[[S334:CMD]]x::xForgotPasswordx::password-recovery ::]][[?x[[S334:CMD]]x::xForgotLoginx::user-name-recovery ::]]::]]
@makbeta
makbeta / single-item-pagination.html
Created February 15, 2013 03:02
Luminate CMS: Pagination for content items, that includes current item. This relies on a field rank, which is a numeric order field, but can be used with timestamp (given that no 2 timestamps are identical). This code is for the list template that will go into single display template.
<t:if test="length > 0">
<t:set id="pageRank" value="rank" />
<t:set id="pageUrl" value="url" />
<t:set id="lastRank" value="0" />
<t:set id="counter" value="1" />
<t:set id="activeIndex" value="-1" />
<t:set id="lastURL" value="''" />
<t:set id="prevLink" value="''" />
@makbeta
makbeta / wordpress-custom-image-size.php
Created March 13, 2013 16:50
WordPress: Add custom image size to the theme (saving for posterity, use of Simple Image Sizes renders this useless)
<?php
/* add this to your functions.php file if you are adding custom images */
function setup_image_sizes() {
if( function_exists('add_theme_support') ) {
add_theme_support('post-thumbnails');
}
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'custom-image', 576, 320, true );
}
@makbeta
makbeta / wordpress-pods-2-featured-image.php
Last active September 22, 2016 01:10
WordPress Pods 2.0 Framework - rendering featured image in template
@makbeta
makbeta / html-style-test.html
Created April 9, 2013 01:28
HTML Ipsum Style Texting
<h1>Header Level 1 - Lorem ipsum dolor sit amet</h1>
<p>Paragraph Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<h2>Header Level 2</h2>
<p>Paragraph Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<h3>Header Level 3</h3>
<p>Paragraph Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.</p>
<h4>Header level 4</h4>
@makbeta
makbeta / wordpress-pods-author.php
Created April 10, 2013 22:57
WordPress Pods 2.0: Display post's author in the pods template
<?php
$row = $obj->row();
$author_id=$row['post_author'];
$author = get_the_author_meta( 'display_name', $author_id );
?>
<?php print $author; ?>
<div class="post">
<h3><a href="{@permalink}">{@title}</a></h3>
<div class="author">Posted by <?php print $author; ?></div>