Skip to content

Instantly share code, notes, and snippets.

@guillermorangel
guillermorangel / console_commands.txt
Last active September 9, 2020 01:38
Helpful Console Commands
rm /usr/local/var/postgres/postmaster.pid
yarn run stylelint -q app/assets/**/*.scss
bundle exec erblint "app/**/*.{html,js,svg,text}{+*,}.erb"
git config --global alias.rom '!TMP_CURR_BRANCH=$(git branch --show-current) && git checkout master && git pull && git checkout $TMP_CURR_BRANCH && git rebase master && unset TMP_CURR_BRANCH'
<?php
//wp_get_attachment_image_src( $attachment_id, $size, $icon );
$featureimage = wp_get_attachment_image_src( get_post_thumbnail_id() );
$featureimage_url = $featureimage[0];
echo $featureimage_url;
// https://css-tricks.com/snippets/wordpress/get-featured-image-url/
$thumb_id = get_post_thumbnail_id();
$thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail-size', true);
$thumb_url = $thumb_url_array[0];
@guillermorangel
guillermorangel / sequencial_order_of_wp_hooks
Created December 6, 2013 00:26
Sequential order of wordpress hooks
Loading my main page
16:33:53 - action:muplugins_loaded
16:33:53 - action:registered_taxonomy
16:33:53 - action:registered_taxonomy
16:33:53 - action:registered_taxonomy
16:33:53 - action:registered_taxonomy
16:33:53 - action:registered_taxonomy
16:33:53 - action:registered_post_type
16:33:53 - action:registered_post_type
@guillermorangel
guillermorangel / clean_wp_head.php
Created December 4, 2013 19:53
Cleanup the WordPress, free of stuff that we done need. Additonal code for woothemes child theme stylesheet load re-order
<?php
// Remove WP Stuff from the head
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
remove_action( 'wp_head', 'index_rel_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
@guillermorangel
guillermorangel / after_setup_theme.php
Created November 26, 2013 16:06
Override parent theme functions by running code after theme setup
<?php
function osu_twentyten_continue_reading_link() {
return ' <a href="'. get_permalink() . '">' . __( 'Read on <span class="meta-nav">&rarr;</span>', 'twentyten-child' ) . '</a>';
}
function osu_twentyten_auto_excerpt_more( $more ) {
return ' &hellip;' . osu_twentyten_continue_reading_link();
}
@guillermorangel
guillermorangel / ie7.css.scss
Created November 15, 2013 02:45
css for ie7 overlay
/* IE upgrade overlay */
#ie-warning-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2000;
filter: alpha(opacity=90);
@guillermorangel
guillermorangel / if_ie_7.html
Created November 15, 2013 02:34
overlay if ie7 is detected
<!--[if lt IE 8]> <div id="ie-warning-overlay"> <div id="ie-warning"> <h1>Did you know that your copy of Internet Explorer is terribly out of date?</h1> <p> To get the best possible experience using our website, we recommend that you upgrade to the latest version or use another web browser. Any of the following will provide a superior experience, not only on this site, but across the web. </p> <p>Just click one of the icons below to get to the download page.</p> <ul> <li> <a href="http://microsoft.com/ie"> <img alt="Download Internet Explorer" src="images/browser_ie.gif" /> <p>Internet Explorer 9+</p> </a> </li> <li> <a href="http://mozilla.org/firefox"> <img alt="Download Firefox" src="images/browser_firefox.gif" /> <p>Firefox</p> </a> </li> <li> <a href="http://google.com/chrome"> <img alt="Download Chrome" src="images/browser_chrome.gif" /> <p>Google Chrome</p> </a> </li> <li> <a href="http://apple.com/safari"> <img alt="Download Safari" src="images/browser_safari.gif" /> <p>Safari</p> </a> </li> <li> <a h
<?php
function custom_excerpt_length( $length ) {
return 120;
} add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function new_excerpt_more( $more ) {
return ' <a class="read-more" href="' . get_permalink( get_the_ID() ) . '">' . __( 'Read More', 'your-text-domain' ) . '</a>';
}
@guillermorangel
guillermorangel / li_color_variation.css.scss
Created September 23, 2013 19:57
list color variation
@for $i from 1 through 4 {
&:nth-child(#{$i}) {
background-color: $color_secondary;
}
$color_secondary: lighten( $color_secondary, 10% );
}
@guillermorangel
guillermorangel / extensive_link_to_image_tag.erb
Created September 19, 2013 14:52
Extensive link and image properties