Skip to content

Instantly share code, notes, and snippets.

View ajvillegas's full-sized avatar

Alexis J. Villegas ajvillegas

View GitHub Profile
@nickdavis
nickdavis / functions.php
Last active April 27, 2018 05:28
Using default WordPress next / prev post links check if one exists first and update CSS classes accordingly [not complete code]
<?php
// @link http://www.jaredatchison.com/code/add-next-previous-post-links-genesis/
// Check if there are next or previous posts
// First paramter is 'in_same_term'?, make sure it matches third parameter in previous_post_link / next_post_link (which defaults to false)
$next = get_adjacent_post( false, '', false );
$previous = get_adjacent_post( false, '', true );
//Set up CSS styles to know if there are next or previous posts only
@kittenlane
kittenlane / add_currency_code_suffix.php
Created May 3, 2015 22:49
Add currency code as suffix to prices in WooCommerce
//* http://www.codemyownroad.com/add-currency-code-suffix-prices-woocommerce/
// Location: add to functions.php
// Output: displays $0.00 AUD on all pages
function addPriceSuffix($format, $currency_pos) {
switch ( $currency_pos ) {
case 'left' :
$currency = get_woocommerce_currency();
$format = '%1$s%2$s&nbsp;' . $currency;
break;
@remyperona
remyperona / gist:13348dbcd2bbb0d9406f
Created April 14, 2015 14:32
WordPress customizer custom tinymce control
class Text_Editor_Custom_Control extends WP_Customize_Control
{
public $type = 'textarea';
/**
** Render the content on the theme customizer page
*/
public function render_content() { ?>
<label>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

@include font-face(Samplino, fonts/Samplino);
@trusktr
trusktr / DefaultKeyBinding.dict
Last active January 24, 2026 00:20
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@rianrietveld
rianrietveld / rrwd_remove_page_template
Created April 24, 2014 07:52
Remove page templates from dropdown page attributes in WordPress ( >= 3.9 )
<?php
add_filter( 'theme_page_templates', 'rrwd_remove_page_template' );
function rrwd_remove_page_template( $pages_templates ) {
unset( $pages_templates['page_blog.php'] );
unset( $pages_templates['page_archive.php'] );
return $pages_templates;
}
?>
@WebEndevSnippets
WebEndevSnippets / functions.php
Created January 3, 2014 20:03
Genesis : Add comment count and remove standard comment title
add_action( 'genesis_before_comments' , 'webendev_comment_count' );
/**
* Add comment count and remove standard comment title
*
*/
function webendev_comment_count () {
add_filter( 'genesis_title_comments', '_return_null' );
if ( is_single() ) {
if ( have_comments() ) {
echo '<h3>';
@hissy
hissy / functions.php
Created October 1, 2013 23:52
[WordPress/Filter] Exclude specific category from your blog
<?php
// Exclude 'example' category from your blog
function my_get_terms_args_exclude( $args, $taxonomies ) {
if (!is_admin()) {
$cat = get_category_by_slug( 'example' );
if ( is_object( $cat ) ) {
$args['exclude'] = $cat->term_id;
}
}
@natebot
natebot / is-meta-box-registered.php
Last active October 9, 2024 00:22
Test if a WordPress meta box has been registered.
<?php
/**
* Check if a meta box has been registered.
* Returns true if the supplied meta box id has been registered. false if not.
* Note that this does not check what page type
* @param String $meta_box_id An id for the meta box.
* @param String $post_type The post type the box is registered to (optional)
* @return mixed Returns boolean or a WP_Error if $wp_meta_boxes is not yet set.
*/
@irazasyed
irazasyed / Install Composer using MAMP's PHP.md
Last active May 30, 2025 08:59
Instructions on how to change preinstalled Mac OS X PHP to MAMP's PHP Installation and then install Composer Package Management

Change default Mac OS X PHP to MAMP's PHP Installation and Install Composer Package Management


Instructions to Change PHP Installation


First, Lets find out what version of PHP we're running (To find out if it's the default version).

To do that, Within the terminal, Fire this command:

which php