Skip to content

Instantly share code, notes, and snippets.

View tylerforret's full-sized avatar

Tyler Forret tylerforret

View GitHub Profile
@tylerforret
tylerforret / Wordpress CSE Search.html
Last active May 26, 2017 17:25
Wordpress Default Search + In-Site Google CSE
<!-- Create or edit "searchform.php" in theme folder
Replace what is there with the google cse script - example below
**Note: You will need to edit the final line outside the script with the custom parameters: resultsUrl & queryParameterName
-->
<script>
(function() {
@tylerforret
tylerforret / functions.php
Last active November 17, 2023 09:52
Allow <span> Tags in Wordpress Post/Page Editor
<?php
/*Allow Span tags in editor*/
function myextensionTinyMCE($init) {
// Command separated string of extended elements
$ext = 'span[id|name|class|style]';
// Add to extended_valid_elements if it alreay exists
if ( isset( $init['extended_valid_elements'] ) ) {
$init['extended_valid_elements'] .= ',' . $ext;
} else {
@tylerforret
tylerforret / anchor-link-height-fix.css
Last active April 15, 2016 16:50
CSS solution for jump/anchor link style menus with a fixed header that causes the jump to go to the wrong spot on the page.
@tylerforret
tylerforret / functions.php
Last active April 15, 2016 16:57
Wordpress Custom Excerpt Lengths w/ Links
<?php
// Custom excerpt lengths
function get_excerpt($count){
$permalink = get_permalink($post->ID);
$words = array();
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt, '<a>'); //allow links within excerpt
$excerpt = strip_shortcodes( $excerpt );
$excerpt = substr($excerpt, 0, $count);
$excerpt = $excerpt;