Skip to content

Instantly share code, notes, and snippets.

View siriokun's full-sized avatar

Rio Purnomo siriokun

View GitHub Profile
@siriokun
siriokun / wp-update_tagline.php
Created June 11, 2012 13:16
Check if WordPress site description is default, show notice to update
<?php
/**
* Checks to see if your tagline is set to the default and shows an admin notice to update it
* Throw this in function.php for your theme
*/
if (get_option('blogdescription') == 'Just another WordPress site') { add_action('admin_notices', create_function( '', "echo '<div class=\"error\"><p>".sprintf(__('Please update your <a href="%s">tagline</a>', 'bb'), admin_url('options-general.php'))."</p></div>';" ) ); };
// Different approach
/**
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
<?php
/**
* Modify the "Enter title here" text when adding new CPT, post or page
*
* @access public
* @since 1.0
* @return void
*/
function rc_change_default_title( $title ){
@siriokun
siriokun / wp-config.php
Created January 7, 2013 10:32 — forked from anonymous/wp-config.php
This in wp-config to be able to run the blog both locally and deployed on AppFog
$services = getenv("VCAP_SERVICES");
if ( $services != null){
$services_json = json_decode($services,true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
define('DB_NAME', $mysql_config["name"]);
define('DB_USER', $mysql_config["user"]);
define('DB_PASSWORD', $mysql_config["password"]);
define('DB_HOST', $mysql_config["hostname"]);
define('DB_PORT', $mysql_config["port"]);
<?php
function showalltags() {
$tags = get_tags();
$html;
foreach ($tags as $tag){
$tag_link = get_tag_link($tag->term_id);
$html .= "<a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
<ul id="slidecontrols">
<li><a href="#one">One</li>
<li><a href="#two">Two</li>
</ul>
<div id="slides">
<div>This is content block One</div>
<div>This is content block Two</div>
</div>
a[href^="http://"] {
/* fully valid URL, likely external link */
}
a[href="http://google.com"] {
/* link to specific website */
}
a[href^="/"], a[href^=".."] {
/* internal relative link */
@siriokun
siriokun / css-link.js
Last active August 29, 2015 14:01 — forked from replete/gist:2436076
/* -------------------------------------- */
//iOS-like scrollbar
var $niceScrollContainers = $("[data-ios-scroll]");
$niceScrollContainers.each(function () {
var $container = $(this),
scrollClass = $container.attr("data-ios-scroll"),
cursorWidth = "6px",
$contentsLastChild = $container.children("*:last-child");
//jQuery
$("#swapImg")
.attr("src", "dynamic-image-url.jpg")
.one("load",function(){
//image has loaded
})
.each(function(){
if(this.complete) //trigger load if cached in certain browsers
$(this).trigger("load");