Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
@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;
@SiGaCode
SiGaCode / microdata01.html
Last active July 14, 2017 17:58
Getting started with schema.org using Microdata for business infos http://schema.org/docs/gs.html#microdata_how
<!-- Example 1, schneidet im Google validator am Besten ab -->
<p itemscope itemtype="http://schema.org/LocalBusiness">
<strong itemprop="name">ACME</strong><br />
<span itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"><span itemprop="streetAddress">Hollywood Boulevard</span><br />
<span itemprop="postalCode">12345</span> <span itemprop="addressLocality">Sin City</span><br /></span>
Tel.: <span itemprop="telephone" content="+15552345567">555-2345567</span><br />
<a itemprop="email" content="info@example.com" href="/cdn-cgi/l/email-protection#aac3c4ccc5eacfd2cbc7dac6cf84c9c5c795d9dfc8c0cfc9de97ecffffffff">info@example.com</a><meta itemprop="url" content="http://www.example.com/" />
</p>
<!-- Example 2 -->
<div itemscope itemtype ="http://schema.org/Movie">
@SiGaCode
SiGaCode / remove-admin-sidebar-items.php
Last active October 6, 2017 14:27
Remove unwanted items from the WP admin sidebar. Useful if you don´t want to run any blog-related things on a site. Credit: https://managewp.com/wordpress-admin-sidebar-remove-unwanted-items #PHP #dashboard
/*-----------------------------------------------------------------------------------*/
/* Remove Unwanted Admin Menu Items */
/*-----------------------------------------------------------------------------------*/
function remove_admin_menu_items() {
// Edit only the following line to remove the items you don´t need
$remove_menu_items = array(__('Comments'),__('Posts'));
global $menu;
end ($menu);
while (prev($menu)){
@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">'; };