CINXE.COM

hi! Rizh | Simple guy loving web design with simple minimalist concept.

<!DOCTYPE html> <!--[if IE 7 | IE 8]><html class="ie" lang="en-US"> <![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--><html lang="en-US"> <!--<![endif]--><head><script type="text/javascript" src="https://web-static.archive.org/_static/js/bundle-playback.js?v=7YQSqjSh" charset="utf-8"></script> <script type="text/javascript" src="https://web-static.archive.org/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="https://web-static.archive.org/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("http://hirizh.name/","20130120112116","https://web.archive.org/","web","https://web-static.archive.org/_static/", "1358680876"); </script> <link rel="stylesheet" type="text/css" href="https://web-static.archive.org/_static/css/banner-styles.css?v=p7PEIJWi" /> <link rel="stylesheet" type="text/css" href="https://web-static.archive.org/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <link rel="stylesheet" href="https://web.archive.org/web/20130120112116cs_/http://hirizh.name/wp-content/plugins/wp-minify/cache/4299412262689b9a13efb03c64f16153.css?m=1358571349" type="text/css" media="screen"/> <script type="text/javascript" src="https://web.archive.org/web/20130120112116js_/http://hirizh.name/wp-content/plugins/wp-minify/cache/0e089ca58e635ca883cd0c29417ff6b0.js?m=1358440252"></script> <meta charset="UTF-8"/><meta name="viewport" content="width=device-width"/><title>hi! Rizh | Simple guy loving web design with simple minimalist concept.</title><link rel="profile" href="http://gmpg.org/xfn/11"/><link rel="pingback" href="http://hirizh.name/xmlrpc.php"/> <!--[if lt IE 9]> <![endif]--><link rel="alternate" type="application/rss+xml" title="hi! Rizh 禄 Feed" href="https://web.archive.org/web/20130120112116/http://hirizh.name/feed/"/><link rel="alternate" type="application/rss+xml" title="hi! Rizh 禄 Comments Feed" href="https://web.archive.org/web/20130120112116/http://hirizh.name/comments/feed/"/><link rel="stylesheet" id="twentytwelve-fonts-css" href="https://web.archive.org/web/20130120112116cs_/http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&amp;subset=latin,latin-ext" type="text/css" media="all"/><link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://hirizh.name/xmlrpc.php?rsd"/><link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://hirizh.name/wp-includes/wlwmanifest.xml"/><meta name="generator" content="WordPress 3.5"/><style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style><style type="text/css" id="custom-background-css">body.custom-background { background-color: #e6e6e6; }</style> <script type="text/javascript">var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-30534679-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://web.archive.org/web/20130120112116/https://ssl' : 'https://web.archive.org/web/20130120112116/http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script> </head><body class="home blog custom-background custom-font-enabled single-author"><div id="page" class="hfeed site"> <header id="masthead" class="site-header" role="banner"> <hgroup><h1 class="site-title"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/" title="hi! Rizh" rel="home">hi! Rizh</a></h1><h2 class="site-description">Simple guy loving web design with simple minimalist concept.</h2> </hgroup> <nav id="site-navigation" class="main-navigation" role="navigation"><h3 class="menu-toggle">Menu</h3><div class="skip-link assistive-text"><a href="#content" title="Skip to content">Skip to content</a></div><div class="menu-primary-container"><ul id="menu-primary" class="nav-menu"><li id="menu-item-12" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-12"><a title="Blogazine playground" href="https://web.archive.org/web/20130120112116/http://playground.hirizh.name/">Playground</a></li><li id="menu-item-36" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/handmade/">Handmade</a><ul class="sub-menu"><li id="menu-item-63" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-63"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/minimalizine-wordpress-theme/">Minimalizine WordPress Theme</a></li></ul></li><li id="menu-item-37" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-37"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/say-hi/">Say Hi</a></li></ul></div> </nav> </header><div id="main" class="wrapper"><div id="primary" class="site-content"><div id="content" role="main"> <article id="post-79" class="post-79 post type-post status-publish format-standard hentry category-thoughts tag-2013 tag-minimalizine tag-my-thoughts tag-wordpress-com-theme"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/new-year/" title="Permalink to New Year!" rel="bookmark">New Year!</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/new-year/#respond" title="Comment on New Year!"><span class="leave-reply">Leave a reply</span></a></div> </header><div class="entry-content"><p>I know its been a while since new years eve. But, whooa, its been a long time not writing on my (own) blog too! The last post I wrote was on August of 2012 when I checked. Yeah, I&#8217;d been busy with my school tasks and some school organizations duty. On another side, I was having some side project for my friend and learning WordPress plugin development, and still working on it.</p><p>Oh, almost forgot, its new year right? Welcome to 2013! Hope it would be a good year for me, and good to for ya&#8217;ll. <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"/></p><p>Last Saturday was a really nice day. When i checked my email in the morning, I saw a mail from Caroline Moore (sixhours), and unbelievably, Minimalizine was live at WordPress.com. I&#8217;d have been got an email from her few weeks ago, she told me that Minimalizine would be remarked to be live at WordPress.com directory. I was so glad and happy to know that <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"/></p><p>You can read the announcement of it from<a href="https://web.archive.org/web/20130120112116/http://en.blog.wordpress.com/2013/01/11/new-theme-minimalizine/"> WordPress.com&#8217;s blog</a> and/or <a href="https://web.archive.org/web/20130120112116/http://theme.wordpress.com/themes/minimalizine/">start a new blog there</a> with Minimalizine.</p><p>By now, i&#8217;m working for updating Minimalizine on WordPress.org directory and hope it&#8217;ll available soon. One more theme will cooming after. <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"/></p></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/thoughts/" title="View all posts in Thoughts" rel="category tag">Thoughts</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/2013/" rel="tag">2013</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/minimalizine/" rel="tag">minimalizine</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/my-thoughts/" rel="tag">my thoughts</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/wordpress-com-theme/" rel="tag">WordPress.com theme</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/new-year/" title="3:53 PM" rel="bookmark"><time class="entry-date" datetime="2013-01-14T15:53:30+00:00" pubdate>January 14, 2013</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-52" class="post-52 post type-post status-publish format-standard hentry category-panada tag-gravatar-panada tag-panada-framework"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/gravatar-library-panada/" title="Permalink to Gravatar Library for Panada Framework" rel="bookmark">Gravatar Library for Panada Framework</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/gravatar-library-panada/#respond" title="Comment on Gravatar Library for Panada Framework"><span class="leave-reply">Leave a reply</span></a></div> </header><div class="entry-content"><p>For last few weeks, I&#8217;ve been learning <a title="Panada Framework" href="https://web.archive.org/web/20130120112116/http://panadaframework.com/" target="_blank">Panada Framework</a>, simple PHP framework made by Indonesian, <a href="https://web.archive.org/web/20130120112116/https://github.com/k4ndar" target="_blank">Iskandar Soesman</a>. It works simlple, as simple as Codeigniter and I thought its simpler <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley"/></p><p>I&#8217;m still a new player in PHP world, but i really wanted to contribute to this projects. So, I decided to write, editing exactly, a Gravatar library for Panada.</p><h4>Simple to Use</h4><ol><li>Put <code>Gravatar.php</code> in your <code>app/Libraries</code> folder.</li><li>Initialize the library: <code>$this-&gt;gravatar = new Libraries\Gravatar; </code></li><li>Get the image: <code>$this-&gt;gravatar-&gt;get('email@email.com');</code></li></ol><p><a title="Fork Gravatar Panada at Github" href="https://web.archive.org/web/20130120112116/https://github.com/hirizh/Panada-Gravatar" target="_blank">Fork at Github</a></p></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/panada/" title="View all posts in Panada" rel="category tag">Panada</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/gravatar-panada/" rel="tag">gravatar panada</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/panada-framework/" rel="tag">panada framework</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/gravatar-library-panada/" title="10:12 AM" rel="bookmark"><time class="entry-date" datetime="2012-08-12T10:12:49+00:00" pubdate>August 12, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-48" class="post-48 post type-post status-publish format-standard hentry category-code-snippet category-linux tag-node-js"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/installing-node-js-on-ubuntu/" title="Permalink to Installing Node.js on Ubuntu" rel="bookmark">Installing Node.js on Ubuntu</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/installing-node-js-on-ubuntu/#respond" title="Comment on Installing Node.js on Ubuntu"><span class="leave-reply">Leave a reply</span></a></div> </header><div class="entry-content"><p>I was reading at <a title="CSS Compressor and Minification" href="https://web.archive.org/web/20130120112116/http://davidwalsh.name/clean-css" target="_blank">David Walsh&#8217;s writing</a> about CSS compressor and minification using clean-css based on Node.js. Then聽 try installing Node.js on my netbook. I found from official <a href="https://web.archive.org/web/20130120112116/https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager" target="_blank">Joyent Node.js wiki</a> page:</p><pre class="brush: bash; gutter: true">sudo apt-get install python-software-properties sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install nodejs npm</pre><p>Yeah, it works now <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_biggrin.gif" alt=":D" class="wp-smiley"/></p></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/" title="View all posts in Code Snippet" rel="category tag">Code Snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/linux/" title="View all posts in Linux" rel="category tag">Linux</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/node-js/" rel="tag">Node.js</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/installing-node-js-on-ubuntu/" title="9:27 AM" rel="bookmark"><time class="entry-date" datetime="2012-08-12T09:27:48+00:00" pubdate>August 12, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-44" class="post-44 post type-post status-publish format-standard hentry category-code-snippet category-wordpress tag-code-snippet-2 tag-contributor-role tag-wordpress-2 tag-wordpress-user"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/contributor-edit-their-published-posts/" title="Permalink to Let Contributor Edit Their Published Posts on WordPress" rel="bookmark">Let Contributor Edit Their Published Posts on WordPress</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/contributor-edit-their-published-posts/#comments" title="Comment on Let Contributor Edit Their Published Posts on WordPress">4 Replies</a></div> </header><div class="entry-content"><p>Yesterday, I asked by a friend to publish his post at <a title="Blogazinist" href="https://web.archive.org/web/20130120112116/http://blogazinist.com/" target="_blank">Blogazinist</a>. I published it then, and realized that the post was not the final yet. He wanted to edit it, so I 聽pending that post again. And had been doing those activity for many times.</p><p>By default, we set registered user on Blogazinist as a contributor. After reading a while at WordPress Codex about <a title="WordPress Codex: Roles and capabilities" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">User Roles and Capabilities</a>, I knew that contributor can edit their posts, but not after it&#8217;s published. Then I scrolling down <code>edit_published_posts</code> capability. Then I thought to add that capability to contributor role.</p><p>We all knew, WordPress gives easy way to modify its core functions by hooking to that function. So, to achieve that, I hooked to <code>admin_init</code> function. Also using <code>get_role</code> function to get contributor role and add a new聽capability聽on it.</p><pre class="brush: php; gutter: true">function contributor_edit_published() { $contributor = get_role(&#039;contributor&#039;); $contributor-&gt;add_cap(&#039;edit_published_posts&#039;); } add_action(&#039;admin_init&#039;, &#039;contributor_edit_published&#039;);</pre><p>By now, Blogazinist&#8217;s contributor could edit their published posts. <img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley"/></p><h3>Reference</h3><ul><li><a title="WordPress Codex: Roles and capabilities" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">WordPress Codex: Roles and Capabilities</a></li><li><a title="WordPress Codex: Get Role" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Function_Reference/get_role" target="_blank">WordPress Codex: <code>get_role</code></a></li><li><a title="WordPress Codex: add_cap" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Function_Reference/add_cap" target="_blank">WordPress Codex: <code>add_cap</code></a></li></ul></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/" title="View all posts in Code Snippet" rel="category tag">Code Snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/wordpress/" title="View all posts in WordPress" rel="category tag">WordPress</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/code-snippet-2/" rel="tag">code snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/contributor-role/" rel="tag">contributor role</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/wordpress-2/" rel="tag">wordpress</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/wordpress-user/" rel="tag">WordPress user</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/contributor-edit-their-published-posts/" title="4:44 PM" rel="bookmark"><time class="entry-date" datetime="2012-05-23T16:44:02+00:00" pubdate>May 23, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-27" class="post-27 post type-post status-publish format-standard hentry category-code-snippet category-wordpress tag-audio-post-format tag-code-snippet-2 tag-wordpress-2"> <header class="entry-header"> <img width="250" height="150" src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-content/uploads/2012/04/soundcloud-embed.png" class="attachment-post-thumbnail wp-post-image" alt="Soundcloud oEmbed Support in WordPress"/><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/soundcloud-oembed-support-in-wordpress/" title="Permalink to Soundcloud oEmbed Support in WordPress" rel="bookmark">Soundcloud oEmbed Support in WordPress</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/soundcloud-oembed-support-in-wordpress/#comments" title="Comment on Soundcloud oEmbed Support in WordPress">9 Replies</a></div> </header><div class="entry-content"><p><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/wp-content/uploads/2012/04/soundcloud-embed.png"><img src="https://web.archive.org/web/20130120112116im_/http://hirizh.name/wp-content/uploads/2012/04/soundcloud-embed.png" alt="Soundcloud oEmbed Support in WordPress" title="soundcloud-embed" width="250" height="150" class="alignleft size-full wp-image-39"/></a><br/> It&#8217;s come from another post format I made in my tumblog theme. I&#8217;ve add a custom meta box in post editor to easily deal with the post format. Firstly, there&#8217;s a text input for audio URL and a textarea for <a title="SoundCloud" href="https://web.archive.org/web/20130120112116/http://soundcloud.com/" target="_blank">SoundCloud</a> embed code. I thought that&#8217;s not an effective way to solve this problem. I want just a text input for both audio URL or SoundCloud URL.</p><p>I looking for another way more effective and found built-in WordPress function, <code>wp_oembed_get()</code>. But I realized that the built-in library in WordPress doesn&#8217;t support SoundCloud oEmbed yet. Here the function <code>wp_oembed_add_provider()</code> works.</p><pre class="brush: php; gutter: true; first-line: 1; highlight: []; html-script: false">// Register oEmbed support for Soundcloud wp_oembed_add_provider( &#039;http://soundcloud.com/*&#039;, &#039;http://soundcloud.com/oembed&#039; );</pre><p>The first argument, <code>http://soundcloud.com/*</code> is the URL structure that this (SoundCloud) oEmbed provider supports. The second, <code>http://soundcloud.com/oembed</code> is the base URL of the oEmbed provider. Actually there&#8217;s third argument, <code>regex</code>, but we doesn&#8217;t need it this time.</p><p>Here is the example of post custom meta data:</p><pre class="brush: php; gutter: true; first-line: 1; highlight: []; html-script: false">// Get the URL from custom field $audio = get_post_meta($post-&amp;gt;ID, &#039;daoon_audio&#039;, true); // Echo the embedded sound if ($audio) echo wp_oembed_get($audio);</pre><p>And lastly, we just paste the SoundCloud track URL to the meta box and it automatically embedded. One thing I didn&#8217;t find the way is how we add a parameter to the embedded URL without entering it directly in the box. There&#8217;s an array argument after the URL at <code>wp_oembed_get()</code>, but I tried and it doesn&#8217;t work. Anyone knows, please leave at comment, thanks.</p><h3>Useful Links</h3><ol><li><a title="WordPress Embeds" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Embeds" target="_blank">WordPress Embeds</a></li><li><a title="Function Reference: wp_oembed_get()" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Function_Reference/wp_oembed_get" target="_blank">Function Reference: wp oembed get()</a></li><li><a title="Function Reference: wp_oembed_add_provider()" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Function_Reference/wp_oembed_add_provider" target="_blank">Function Reference: wp oembed add provider()</a></li><li><a title="Function Reference/wp embed register handler" href="https://web.archive.org/web/20130120112116/http://codex.wordpress.org/Function_Reference/wp_embed_register_handler">Function Reference: wp_embed_register_handler()</a>, registering non-oEmbed support</li></ol></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/" title="View all posts in Code Snippet" rel="category tag">Code Snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/wordpress/" title="View all posts in WordPress" rel="category tag">WordPress</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/audio-post-format/" rel="tag">audio post format</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/code-snippet-2/" rel="tag">code snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/wordpress-2/" rel="tag">wordpress</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/soundcloud-oembed-support-in-wordpress/" title="9:59 AM" rel="bookmark"><time class="entry-date" datetime="2012-04-07T09:59:02+00:00" pubdate>April 7, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-19" class="post-19 post type-post status-publish format-standard hentry category-code-snippet category-wordpress tag-chat-post-format tag-chat-style tag-code-snippet-2 tag-wordpress-2"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/styling-chat-transcript-for-custom-post-format/" title="Permalink to Styling Chat Transcript for Custom Post Format" rel="bookmark">Styling Chat Transcript for Custom Post Format</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/styling-chat-transcript-for-custom-post-format/#comments" title="Comment on Styling Chat Transcript for Custom Post Format">7 Replies</a></div> </header><div class="entry-content"><p>I&#8217;ve been busy making a new WordPress tumblog theme. This theme comes with 8 different post format. I thought to make a different layout of chat format was such a great idea. I search how to deal this problem and got some results, but there&#8217;s only one which solving my problem, with some modification of the code.</p><pre class="brush: php; gutter: true">function daoon_chat_post($content) { global $post; if (has_post_format(&#039;chat&#039;)) { remove_filter (&#039;the_content&#039;,聽 &#039;wpautop&#039;); $chatoutput = &quot;&lt;ul class=\&quot;chat\&quot;&gt;\n&quot;; $split = preg_split(&quot;/(\r?\n)+|(&lt;br\s*\/?&gt;\s*)+/&quot;, $content); foreach($split as $haystack) { if (strpos($haystack, &quot;:&quot;)) { $string = explode(&quot;:&quot;, trim($haystack), 2); $who = strip_tags(trim($string[0])); $what = strip_tags(trim($string[1])); $row_class = empty($row_class)? &quot; class=\&quot;chat-highlight\&quot;&quot; : &quot;&quot;; $chatoutput = $chatoutput . &quot;&lt;li&gt;&lt;strong&gt;$who&lt;/strong&gt;&lt;p&gt;$what&lt;/p&gt;&lt;/li&gt;\n&quot;; } else { $chatoutput = $chatoutput . $haystack . &quot;\n&quot;; } } // print our new formated chat post $content = $chatoutput . &quot;&lt;/ul&gt;\n&quot;; return $content; } else { return $content; } } add_filter(&#039;the_content&#039;, &#039;daoon_chat_post&#039;, 9);</pre><p>Line 3, <code>if (has_post_format('chat'))</code>, check whether the post has chat post format or not, then filter the content for re-layouting. The output then has a <code>&lt;li&gt;</code> element for each person and message inside an <code>&lt;ul&gt;</code> element.</p><h3>Reference</h3><ol><li><a title="Permalink to Tumblr Style Chat Posts for WordPress" href="https://web.archive.org/web/20130120112116/http://www.jasonferguson.me/tumblr-style-chat-posts-for-wordpress/" rel="bookmark">Tumblr Style Chat Posts for WordPress</a></li></ol></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/" title="View all posts in Code Snippet" rel="category tag">Code Snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/wordpress/" title="View all posts in WordPress" rel="category tag">WordPress</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/chat-post-format/" rel="tag">chat post format</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/chat-style/" rel="tag">chat style</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/code-snippet-2/" rel="tag">code snippet</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/wordpress-2/" rel="tag">wordpress</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/styling-chat-transcript-for-custom-post-format/" title="4:36 PM" rel="bookmark"><time class="entry-date" datetime="2012-04-06T16:36:15+00:00" pubdate>April 6, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article> <article id="post-1" class="post-1 post type-post status-publish format-standard hentry category-thoughts tag-first-post tag-my-thoughts tag-welcome"> <header class="entry-header"><h1 class="entry-title"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/hello-world/" title="Permalink to Hello World! Welcome" rel="bookmark">Hello World! Welcome</a></h1><div class="comments-link"> <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/hello-world/#comments" title="Comment on Hello World! Welcome">9 Replies</a></div> </header><div class="entry-content"><p>Hey, welcome! I&#8217;m Rizqy Hidayat, 16 from Indonesia. I&#8217;m not a web designer nor developer yet, but I love to. I made this blog as a showcase for what I&#8217;ve done and some documentation about web design, WordPress, code snippets, and others.</p><p>Today, I&#8217;m still registered as a student at a High School in Magelang, Jawa Tengah, Indonesia. I&#8217;m not a good student by the way. I spent my time working with my oldish AOA150. Design, coding, blogazining, WordPress theming, and other web stuffs. I&#8217;m a coffee addict and that&#8217;s why I often got sleep after night.</p><p>I love everything to be simple as it should be. Simple is good and no need to complicate. I&#8217;m a <a title="Jason Mraz's fans" href="https://web.archive.org/web/20130120112116/http://jasonmraz.com/" target="_blank">Mrazer</a> and I love listening his songs while typing codes or designing something.</p><p>That might be enough for this first post. Enjoy!</p></div> <footer class="entry-meta"> This entry was posted in <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/thoughts/" title="View all posts in Thoughts" rel="category tag">Thoughts</a> and tagged <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/first-post/" rel="tag">first post</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/my-thoughts/" rel="tag">my thoughts</a>, <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/tag/welcome/" rel="tag">welcome</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/hello-world/" title="7:41 AM" rel="bookmark"><time class="entry-date" datetime="2012-03-27T07:41:37+00:00" pubdate>March 27, 2012</time></a><span class="by-author"> by <span class="author vcard"><a class="url fn n" href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/author/rizqyhidayat/" title="View all posts by Rizqy Hidayat" rel="author">Rizqy Hidayat</a></span></span>. </footer> </article></div></div><div id="secondary" class="widget-area" role="complementary"> <aside id="search-2" class="widget widget_search"><form role="search" method="get" id="searchform" action="https://web.archive.org/web/20130120112116/http://hirizh.name/"><div><label class="screen-reader-text" for="s">Search for:</label> <input type="text" value="" name="s" id="s"/> <input type="submit" id="searchsubmit" value="Search"/></div></form></aside><aside id="archives-2" class="widget widget_archive"><h3 class="widget-title">Archives</h3><ul><li><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/2013/01/" title="January 2013">January 2013</a></li><li><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/2012/08/" title="August 2012">August 2012</a></li><li><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/2012/05/" title="May 2012">May 2012</a></li><li><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/2012/04/" title="April 2012">April 2012</a></li><li><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/2012/03/" title="March 2012">March 2012</a></li></ul> </aside><aside id="categories-2" class="widget widget_categories"><h3 class="widget-title">Categories</h3><ul><li class="cat-item cat-item-9"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/" title="View all posts filed under Code Snippet">Code Snippet</a></li><li class="cat-item cat-item-17"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/code-snippet/linux/" title="View all posts filed under Linux">Linux</a></li><li class="cat-item cat-item-19"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/panada/" title="View all posts filed under Panada">Panada</a></li><li class="cat-item cat-item-4"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/thoughts/" title="View all posts filed under Thoughts">Thoughts</a></li><li class="cat-item cat-item-8"><a href="https://web.archive.org/web/20130120112116/http://hirizh.name/category/wordpress/" title="View all posts filed under WordPress">WordPress</a></li></ul> </aside><aside id="recent-comments-2" class="widget widget_recent_comments"><h3 class="widget-title">Recent Comments</h3><ul id="recentcomments"><li class="recentcomments"><a href="https://web.archive.org/web/20130120112116/https://managewp.com/free-wordpress-themes-november-2012" rel="external nofollow" class="url">Top 5 Free WordPress Themes of the Month &#8212; November 2012 Edition - ManageWP</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/minimalizine-wordpress-theme/#comment-120">Minimalizine WordPress Theme</a></li><li class="recentcomments"><a href="https://web.archive.org/web/20130120112116/http://www.wordpressfamily.com/latest-free-wordpress-themes-from-2012/" rel="external nofollow" class="url">Latest Free WordPress Themes From 2012 | Free WordPress Themes and Plugins</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/minimalizine-wordpress-theme/#comment-116">Minimalizine WordPress Theme</a></li><li class="recentcomments"><a href="https://web.archive.org/web/20130120112116/http://www.noupe.com/wordpress/free-wordpress-themes-fresh-from-october-2012-72987.html" rel="external nofollow" class="url">The Freshest Free WordPress Themes From October 2012 - noupe</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/minimalizine-wordpress-theme/#comment-111">Minimalizine WordPress Theme</a></li><li class="recentcomments"><a href="https://web.archive.org/web/20130120112116/http://hompimpaalaihumgambreng.blogspot.com/" rel="external nofollow" class="url">Taufik Nurrohman</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/contributor-edit-their-published-posts/#comment-77">Let Contributor Edit Their Published Posts on WordPress</a></li><li class="recentcomments"><a href="https://web.archive.org/web/20130120112116/http://ijalfauzi.com/" rel="external nofollow" class="url">Ijal Fauzi</a> on <a href="https://web.archive.org/web/20130120112116/http://hirizh.name/blog/contributor-edit-their-published-posts/#comment-51">Let Contributor Edit Their Published Posts on WordPress</a></li></ul></aside></div></div> <footer id="colophon" role="contentinfo"><div class="site-info"> <a href="https://web.archive.org/web/20130120112116/http://wordpress.org/" title="Semantic Personal Publishing Platform" rel="generator">Proudly powered by WordPress</a></div> </footer></div> <script type="text/javascript">// SyntaxHighlighter.autoloader( "bash shell http://hirizh.name/wp-content/plugins/wp-syntaxhighlighter/syntaxhighlighter3/scripts/shBrushBash.js?ver=3.0" ,"css http://hirizh.name/wp-content/plugins/wp-syntaxhighlighter/syntaxhighlighter3/scripts/shBrushCss.js?ver=3.0" ,"php http://hirizh.name/wp-content/plugins/wp-syntaxhighlighter/syntaxhighlighter3/scripts/shBrushPhp.js?ver=3.0" ,"xml xhtml xslt html http://hirizh.name/wp-content/plugins/wp-syntaxhighlighter/syntaxhighlighter3/scripts/shBrushXml.js?ver=3.0" ); SyntaxHighlighter.defaults['auto-links'] = true; SyntaxHighlighter.defaults['quick-code'] = true; SyntaxHighlighter.defaults['title'] = ''; SyntaxHighlighter.defaults['class-name'] = 'notranslate'; SyntaxHighlighter.defaults['collapse'] = false; SyntaxHighlighter.defaults['first-line'] = 1; SyntaxHighlighter.defaults['gutter'] = true; SyntaxHighlighter.defaults['pad-line-numbers'] = 1; SyntaxHighlighter.defaults['smart-tabs'] = true; SyntaxHighlighter.defaults['tab-size'] = 4; SyntaxHighlighter.defaults['toolbar'] = true; SyntaxHighlighter.config.strings.expandSource = '+ expand source'; SyntaxHighlighter.config.strings.help = '?'; SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n'; SyntaxHighlighter.config.strings.noBrush = "Can't find brush for: "; SyntaxHighlighter.config.strings.brushNotHtmlScript = "Brush wasn't configured for html-script option: "; SyntaxHighlighter.all(); //</script> <script type="text/javascript">/* */ var _wpcf7 = {"loaderUrl":"https:\/\/web.archive.org\/web\/20130120112116\/http:\/\/hirizh.name\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","sending":"Sending ...","cached":"1"}; /* */</script></body> </html> <!-- Dynamic page generated in 2.164 seconds. --> <!-- Cached page generated by WP-Super-Cache on 2013-01-19 13:33:47 --> <!-- Compression = gzip --> <!-- super cache --><!-- FILE ARCHIVED ON 11:21:16 Jan 20, 2013 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 05:18:41 Feb 18, 2025. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 0.567 exclusion.robots: 0.029 exclusion.robots.policy: 0.018 esindex: 0.01 cdx.remote: 12.704 LoadShardBlock: 180.868 (3) PetaboxLoader3.resolve: 182.11 (3) PetaboxLoader3.datanode: 106.948 (4) load_resource: 143.807 -->

Pages: 1 2 3 4 5 6 7 8 9 10