Skip to content

Instantly share code, notes, and snippets.

@SiGaCode
SiGaCode / editor_styles.php
Last active August 29, 2015 14:18
Make the WP editor display theme styles to make it look more like the frontpage - including columns and more. Create a protected assets folder in Dynamik first and add the CSS file (save), then add this in Dynamik Custom - Functions. http://cobaltapps.com/forum/forum/main-category/web-design-talk/60762-how-to-add-column-styles-to-the-wordpress-e…
add_action( 'init', 'cd_add_editor_styles' );
/**
* Apply theme's stylesheet to the visual editor.
*
* @uses add_editor_style() Links a stylesheet to visual editor
* @uses get_stylesheet_directory_uri() Returns URI of childtheme stylesheet directory
*/
function cd_add_editor_styles() {
add_editor_style( get_stylesheet_directory_uri().'/assets/editorstyles.css' );
@SiGaCode
SiGaCode / move_title_own_div.php
Created April 24, 2015 13:27
Relocating Entry Title below Header in Genesis. https://gist.github.com/srikat/8801138
// * Relocate titles on Page, Post and other single pages
add_action( 'genesis_after_header','relocate_entry_title_singular' );
function relocate_entry_title_singular() {
if ( ! is_singular() )
return;
echo '<div class="entry-header-wrapper"><div class="wrap">';
genesis_do_post_title();
genesis_post_info();
echo '</div></div>';
@SiGaCode
SiGaCode / filters_genesis.txt
Last active August 29, 2015 14:19
Default context filters in Genesis and how to use them (adding attributes, for schema markup,....). http://www.rfmeier.net/using-genesis_markup-with-html5-in-genesis-2-0/
Default context filters in Genesis
Context Filter Schema
body genesis_attr_body http://schema.org/WebPage
site-header genesis_attr_site-header http://schema.org/WPHeader
site-title genesis_attr_site-title
site-description genesis_attr_site-description
nav-primary genesis_attr_nav-primary http://schema.org/SiteNavigationElement
@SiGaCode
SiGaCode / links_bordered.css
Created May 13, 2015 07:55
Remove dashed lines around links in Genesis themes
/** Genesis Previous/Next Post Post Navigation */
add_action( 'genesis_before_comments', 'eo_prev_next_post_nav' );
function eo_prev_next_post_nav() {
if ( is_single() ) {
echo '<div class="prev-next-navigation">';
previous_post_link( '<div class="previous">&#10094; %link</div>', '%title' );
@SiGaCode
SiGaCode / remove_emoji.php
Last active September 26, 2016 22:24
Remove emojis and related scripts. There is a plugin also.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@SiGaCode
SiGaCode / shrinking_fixed_header.js
Created May 16, 2015 21:44
Fixed shrinking header with CSS animations and a smaller logo https://gist.github.com/srikat/9224884
jQuery(function( $ ){
$(".site-header").after('<div class="bumper"></div>');
$(window).scroll(function () {
if ($(document).scrollTop() > 50 ) {
$('.site-header').addClass('shrink');
} else {
$('.site-header').removeClass('shrink');
@SiGaCode
SiGaCode / grey_to_color.css
Created May 23, 2015 10:36
Display images in greyscale and fade in color on hover - with SVG and CSS. For portfolios, for example. Credits: http://pandjarov.com/make-your-gallery-fade-to-colour-with-only-svg-and-css/
/*You can modify the “darkness” of the image by playing with the SVG used.*/
/*Hint: Use a specific selector, else it will apply to all pics*/
img {
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
filter: grayscale(100%);
filter: gray; /* IE 6-9 */
}
@SiGaCode
SiGaCode / acf_gen_attr01.php
Created May 27, 2015 09:47
Use genesis_attr to add inline styles via ACF
// Add background-color to .footer-widgets
add_filter( 'genesis_attr_footer-widgets', 'ap_attributes_footer_widgets' );
function ap_attributes_footer_widgets( $attributes ) {
$background = get_field('footer_widgets_bg', option);
$attributes['style'] = 'background-color:' . $background . ';';
return $attributes;
}
//* Link "your-cpt-name" CPT to categories taxonomy
add_action( 'init', 'sk_add_category_taxonomy_to_events' );
function sk_add_category_taxonomy_to_events() {
register_taxonomy_for_object_type( 'category', 'your-cpt-name' );
}