Skip to content

Instantly share code, notes, and snippets.

@SiGaCode
SiGaCode / genesis-bootstrap.php
Created June 5, 2017 14:11
Combine Genesis with Bootstrap, use Genesis filters to add Bootstrap divs and classes while retaining the framework base. Credits: https://teamtreehouse.com/community/bootstrap-or-genesis
<?php
//* Add Bootstrap container class to header
function my_site_bootstrap_header( $attributes ) {
$attributes['class'] = $attributes['class']. ' container-fluid';
return $attributes;
}
add_filter( 'genesis_attr_site-header', 'my_site_bootstrap_header' );
//* Add Bootstrap container wrap around page content
function my_site_start_page_container(){ echo '<div id="page-container" class="container-fluid"><div class="row">'; };
@SiGaCode
SiGaCode / scroll-to-top-script.js
Created July 21, 2016 17:19
The Scroll-to-Top button, skin-integrated (exportable) and using Font-Awesome icon instead of an image. Needs the checkbox to be checked in Dynamik Design - Body - Add Support For Font Awesome Icons
// Goes to Dynamik Design - Skins - Your Skin - JS after the comments
jQuery(document).ready(function($) {
//Scroll to top button
$(window).scroll(function(){
if ($(this).scrollTop() > 200) {
$('.up').fadeIn();
} else {
$('.up').fadeOut();
}
@SiGaCode
SiGaCode / gp-sticky-hook.php
Last active March 19, 2018 11:50
A sticky footer for the GeneratePress theme which will stick to the bottom when the content isn´t long enough and just scroll like a normal footer otherwise.
// For testing purpose, I added this script to a GP hook (wp_head) and had it run for only the test page named "Stickytest". To be valid for the whole site, you might want to enqueue the script.
<?php if ( is_page( 'stickytest' ) ) : ?>
<script>
jQuery(document).ready(function($) {
$(window).resize(function(){
var footerHeight = $('.site-info').outerHeight();
var stickFooterPush = $('.push').height(footerHeight);
@SiGaCode
SiGaCode / gp-sticky-hook.php
Created March 19, 2018 11:25
A sticky footer which will stick to the bottom when the content isn´t long enough and just scroll like a normal footer otherwise.
//* For testing purpose, I added this script to a GP hook (wp_head) and had it run for only the test page named "Stickytest"
<?php if ( is_page( 'stickytest' ) ) : ?>
<script>
jQuery(document).ready(function($) {
$(window).resize(function(){
var footerHeight = $('.site-info').outerHeight();
var stickFooterPush = $('.push').height(footerHeight);
@SiGaCode
SiGaCode / genesis-h1-title.php
Created February 24, 2018 16:51
Filter the Genesis site title to output as h1 on the frontpage and with a custom class. Credits: Carrie Dils, https://gist.github.com/cdils/9002451
// =========== Filter the site title with a custom function ============================
add_filter('genesis_seo_title', 'siga_site_title' );
// Add additional custom style to site header
function siga_site_title( $title ) {
// Change $custom_title text as you wish
$custom_title = 'SG-Layout';
// Don't change the rest of this on down
# ----------------------------------------------------------------------
# | Komprimierung und Caching |
# ----------------------------------------------------------------------
# Serve resources with far-future expires headers.
#
# (!) If you don't control versioning with filename-based
# cache busting, you should consider lowering the cache times
# to something like one week.
#
@SiGaCode
SiGaCode / hide-gp-settings.php
Last active February 1, 2018 18:19
Hides the GeneratePress options (and license) page for any user except admins. https://generatepress.com/forums/topic/limit-access-to-theme-options-menu/
add_action('after_setup_theme','generate_hide_generatepress');
function generate_hide_generatepress()
{
if (current_user_can('activate_plugins') == false) {
remove_action('admin_menu', 'generate_create_menu');
}
}
@SiGaCode
SiGaCode / anchor-offset
Created January 20, 2018 14:29
Set an offset for an onpage anchor, for example if a website has a fixed header and the first part of a paragraph gets hiden. Just add a class of "anchor" to the element in question. Credits: https://stackoverflow.com/questions/4086107/html-positionfixed-page-header-and-in-page-anchors
*.anchor:before {
display: block;
content: " ";
margin-top: -75px; // Set the Appropriate Height
height: 75px; // Set the Appropriate Height
visibility: hidden;
}
/* or */
@SiGaCode
SiGaCode / beaver-columns.css
Created January 17, 2018 11:17
Make all the columns have the same max-width on mobiles for consistency.
@media (max-width: 768px) {
.fl-col {
max-width: 500px; /* choose whatever max-width you want */
}
}
@SiGaCode
SiGaCode / tables-basic
Created January 5, 2018 22:28
Just a bit of table styling for Dynamik/Genesis.
/* ======== A bit of table styling =========== */
table {
width:100%;
font-family: Arial, sans-serif;
font-size: 16px;
}
td,th {
border:1px solid #ddd;