Skip to content

Instantly share code, notes, and snippets.

@tinotriste
tinotriste / gist:5692004
Created June 1, 2013 23:02
LESS: Pipe delimited horizontal menu
.footer-links {
ul {
margin: 0 auto;
list-style-type: none;
li {
width:auto;
margin-right: 10px;
display:inline;
padding:0;
@tinotriste
tinotriste / gist:5653868
Created May 26, 2013 20:06
Wordpress: Get home URL
<?php echo home_url(); ?>

Sublime Text 2 - Useful Shortcuts

Tested in Mac OS X: super == command

Open/Goto


  • super+t: go to file
  • super+ctrl+p: go to project
  • super+r: go to methods
@tinotriste
tinotriste / gist:5639450
Created May 23, 2013 21:11
Wordpress: Translation snippet
<?php _e("",THEME_CODE_NAME); ?>
@tinotriste
tinotriste / maybe-include-plugin.php
Created May 19, 2013 19:51 — forked from alexkingorg/maybe-include-plugin.php
Wordpress: Include plugin into theme
<?php
// Run this code on 'after_theme_setup', when plugins have already been loaded.
add_action('after_setup_theme', 'my_load_plugin');
// This function loads the plugin.
function my_load_plugin() {
// Check to see if your plugin has already been loaded. This can be done in several
// ways - here are a few examples:
@tinotriste
tinotriste / gist:5599947
Created May 17, 2013 15:45
Wordpress: Get site URL
<?php get_site_url(); ?>
@tinotriste
tinotriste / if-function-exists.php
Created April 15, 2013 14:14
Wordpress: Check if function exists
<?php if (function_exists('the_function_name')) { the_function_name(); } ?>
@tinotriste
tinotriste / parent-slug-function.php
Last active January 28, 2021 20:29
Wordpress: Display a page parent's slug
<?php
// Display a page parent's slug
$post_data = get_post($post->post_parent);
$parent_slug = $post_data->post_name;
echo $parent_slug;
?>
@tinotriste
tinotriste / the-slug-function.php
Last active March 22, 2017 19:06
Wordpress: Get post/page slug
<?php
// Custom function to return the post slug
function the_slug($echo=true){
$slug = basename(get_permalink());
do_action('before_slug', $slug);
$slug = apply_filters('slug_filter', $slug);
if( $echo ) echo $slug;
do_action('after_slug', $slug);
return $slug;
}
@tinotriste
tinotriste / the_permalink.php
Created April 15, 2013 13:38
Wordpress: The post/page permalink