This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculates numbers to the mathmatical power (exponent) | |
* | |
* @since 1.0.0 | |
* | |
* @param int $number The number to increase | |
* @param int $exponent The power to increase the number by | |
* | |
* @return int The new number | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Same styles for small devices | |
.alignfull, .alignwide { | |
margin: 0 calc( 50% - 50vw ) $alignment-margin; | |
max-width: 100vw; | |
width: 100vw; | |
} | |
// At "medium" breakpoint it moves to fill in half the viewport's whitespace | |
@media ( min-width: map-get( $grid-breakpoints, md ) ) { | |
.alignwide { | |
margin: 0 calc( ( ( ( 100vw - 100% ) / 2 ) / 2 ) * -1 ) $alignment-margin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add this into your functions.php file. | |
*/ | |
/** | |
* Adding theme support | |
*/ | |
if ( !function_exists( 'rwp_after_setup_theme' ) ) { | |
function rwp_after_setup_theme() { | |
add_theme_support( 'editor-styles' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function repeatable_editor_get_meta( $value ) { | |
global $post; | |
$field = get_post_meta( $post->ID, $value, true ); | |
if ( ! empty( $field ) ) { | |
return is_array( $field ) ? stripslashes_deep( $field ) : stripslashes( wp_kses_decode_entities( $field ) ); | |
} else { | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculates the line height based on font size and the content's width in px. Based | |
* off the research underlying Pearsonified's Golden Ratio Typography Calculator | |
* https://pearsonified.com/typography/ | |
* Ex: $font-size: 16px; | |
* $content-width: 1336px; | |
* $line-height: calculate-line-height( $font-size, $content-width ); | |
* | |
* @since 1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var w = window, | |
d = document, | |
e = d.documentElement, | |
g = d.getElementsByTagName('body')[0], | |
x, y; | |
x = w.innerWidth || e.clientWidth || g.clientWidth; | |
y = w.innerHeight || e.clientHeight || g.clientHeight; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Bootstrap Sample Elements for Theming</title> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css"> | |
<style> | |
body { | |
padding-bottom: 5em; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Create HTML list of pages. | |
* | |
* @since 1.0 | |
* @uses Walker_Page | |
*/ | |
class Rational_Walker_Page extends Walker_Page { | |
/** | |
* @see Walker_Page::start_lvl() | |
* @since 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( is_admin() ) { | |
include 'rational-option-page/class.rational-option-page.php'; | |
$my_options_page = new RationalOptionPages(); | |
$pages = array( | |
// page | |
array( | |
'page_title' => 'My Options', | |
'menu_title' => 'My Options', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// =============================== | |
// Reducing database calls | |
// http://jeremyhixon.com/sandbox/snippet/reducing-database-calls-using-bloginfo/ | |
// | |
// Global variable used to reduce database queries on values commonly requested in themes. | |
// Use "global $bloginfo;" at the beginnng of any theme file and/or function to be able to access the values. | |
// =============================== | |
$bloginfo = array( |
NewerOlder