Skip to content

Instantly share code, notes, and snippets.

@accrane
accrane / functions.php
Created January 3, 2016 13:28
Add Options page to your ACF Dashboard
/* Adds an Options page to your Dashboard */
if( function_exists('acf_add_options_page') ) {
acf_add_options_page();
}
@accrane
accrane / gist:813243866dd9f116d47d
Created February 15, 2016 21:48
Find and Replace phpMyAdmin
UPDATE `table_name`
SET `field_name` = replace(same_field_name, 'unwanted_text', 'wanted_text')
@accrane
accrane / force-upgrade.php
Created March 15, 2016 19:49
Force Upgrade WordPress
<?php
/*
WordPress Force Upgrade Script
Copyright (C) 2006 Mark Jaquith
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
.last-word {
color: #00f;
}
<script>
$(document).ready(function() {
$('.js-title').each(function(index, element) {
var heading = $(element);
var word_array, last_word, first_part;
word_array = heading.html().split(/\s+/); // split on spaces
last_word = word_array.pop(); // pop the last word
first_part = word_array.join(' '); // rejoin the first words together
<h1 class="js-title">My Cool Title</h1>
<?php
// Get RSS Feed(s)
include_once( ABSPATH . WPINC . '/feed.php' );
// Get a SimplePie feed object from the specified feed source.
$rss = fetch_feed( 'http://journeysfromayrden.tumblr.com/rss' );
if ( ! is_wp_error( $rss ) ) : // Checks that the object is created correctly
@accrane
accrane / infinite-previous-next-same-term-looping.php
Last active May 12, 2016 17:18 — forked from banago/infinite-previous-next-looping.php
Infinite next and previous post looping but in same term in WordPress
<?php
/**
* Infinite next and previous post looping in WordPress
*
* This will stay in same Custom Taxonomy Term. Also NEXT and PREVIOUS
* are switched to give the impression of "Going Forard and Back"
*/
if( get_adjacent_post(true, '', false, 'CUSTOM_TAX') ) {
next_post_link( '%link', 'PREVIOUS', TRUE, ' ', 'CUSTOM_TAX' );
@accrane
accrane / function-move-yoast-to-bottom.php
Last active July 7, 2016 19:31
Move Yoast SEO box to the bottom of the page
/*-------------------------------------
Move Yoast to the Bottom
---------------------------------------*/
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@accrane
accrane / custom-flexslider-images-loaded.js
Created January 5, 2017 16:34
Load Flexslider with Images loaded function
$('.flexslider').imagesLoaded( function() {
$('.flexslider').flexslider({
animation: "fade",
slideshowSpeed: 5000,
smoothHeight: true,
}); // end register flexslider
});