Skip to content

Instantly share code, notes, and snippets.

View braginteractive's full-sized avatar

Brad Williams braginteractive

View GitHub Profile
@braginteractive
braginteractive / echo-post-meta.php
Created June 1, 2017 19:24
Echo all Post Meta Data
<?php
$myvals = get_post_meta(get_the_ID());
foreach($myvals as $key=>$val)
{
echo $key . ' : ' . $val[0] . '<br/>';
}
?>
@braginteractive
braginteractive / footer.php
Created May 10, 2017 18:44
Footer with 3 widget areas
@braginteractive
braginteractive / widgets.php
Created May 10, 2017 18:42
3 footer widget areas
<?php
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function strappress_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'strappress' ),
'id' => 'sidebar-1',
@braginteractive
braginteractive / hero-banner.php
Created May 10, 2017 18:29
Hero Banner Template Part
<?php
$hero_image = get_theme_mod( 'hero_image', '' );
$hero_text = get_theme_mod( 'hero_text', '' );
?>
<?php if ($hero_image != '') : ?>
<div class="sp-hero" style="background-image: url('<?php echo esc_url( $hero_image ); ?>')">
<h1><?php echo $hero_text; ?></h1>
</div>
<?php endif; ?>
@braginteractive
braginteractive / _hero.scss
Created May 10, 2017 18:26
Sass styles for Homepage Hero
.sp-hero {
min-height: 500px;
background-position: center top;
background-size: cover;
width: 100%;
background-repeat: no-repeat;
position: relative;
h1 {
color: $white;
@braginteractive
braginteractive / template-home.php
Created May 10, 2017 18:22
Get Template Part for Homepage banner
<?php get_template_part( 'template-parts/home/hero', 'banner' ); ?>
@braginteractive
braginteractive / template-home.php
Created May 10, 2017 18:17
Code to display Hero Banner and Text
<?php
$hero_image = get_theme_mod( 'hero_image', '' );
$hero_text = get_theme_mod( 'hero_text', '' );
?>
<div class="sp-hero" style="background-image: url('<?php echo esc_url( $hero_image ); ?>')">
<h1><?php echo $hero_text; ?></h1>
</div>
@braginteractive
braginteractive / customizer.php
Last active May 12, 2017 16:09
Hero Banner settings for WordPress Customizer
<?php
if ( class_exists( 'Kirki' ) ) {
/**
* Add the theme configuration
*/
Kirki::add_config( 'strappress_theme', array(
'option_type' => 'theme_mod',
'capability' => 'edit_theme_options',
) );
@braginteractive
braginteractive / customizer.php
Last active May 12, 2017 15:59
Kirki code to add Typography to WordPress theme
<?php
/**
* StrapPress Theme Customizer
*
* @package StrapPress
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
@braginteractive
braginteractive / tgm-plugin-activation.php
Created May 1, 2017 21:08
TGM Plugin Activation file for Kirki
<?php
/**
* This file represents an example of the code that themes would use to register
* the required plugins.
*
* It is expected that theme authors would copy and paste this code into their
* functions.php file, and amend to suit.
*
* @see http://tgmpluginactivation.com/configuration/ for detailed documentation.
*