Skip to content

Instantly share code, notes, and snippets.

View hellofromtonya's full-sized avatar

Tonya Mork hellofromtonya

View GitHub Profile
@hellofromtonya
hellofromtonya / general.php
Created August 9, 2014 16:59
Add Number of Views to the WordPress Posts Listings' Columns
add_filter('manage_page_posts_columns' , 'lunarwp_core\add_stats_column');
add_filter('manage_post_posts_columns' , 'lunarwp_core\add_stats_column');
/**
* Add Number of Views to the Post Listings' Columns
*
* @since 1.0.0
*
* @param array $columns Post Listing Columns
* @return array Returns the amended columns array
*/
@hellofromtonya
hellofromtonya / general.php
Last active August 29, 2015 14:05
Adds Stats to the New Column within WordPress' Posts & Pages Listings
add_action('manage_page_posts_custom_column', 'lunarwp_core\add_stats_column_render', 10, 2);
add_action('manage_post_posts_custom_column', 'lunarwp_core\add_stats_column_render', 10, 2);
/**
* Add Stats to to the Posts & Pages Listings (in Admin area)
*
* @since 1.0.0
*
* @param array $column Post Listing Columns
* @param integer $post_id Post ID
* @return array Returns the amended columns array
@hellofromtonya
hellofromtonya / functions.php
Last active August 29, 2015 14:05
Add column class to each of the Genesis Footer Widgets
add_filter('genesis_footer_widget_areas', 'lunarwp\add_columns_to_footer_widgets', 10, 2);
/**
* Add column class to each of the footer widgets
*
* @since 1.0.0
*
* @param string $output HTML output for the footer widgets
* @param string $footer_widgets
* @return string Return the amended $output
*/
@hellofromtonya
hellofromtonya / functions.php
Last active August 29, 2015 14:05
Move the Post/Page's Title (entry title) Just After '.site-inner' (Genesis Framework)
//* Remove the entry header from within the loop &
//* place it into a new hook 'lunarwp_entry_header
remove_all_actions('genesis_entry_header');
add_action('lunarwp_entry_header', 'genesis_do_post_format_image', 4);
add_action('lunarwp_entry_header', 'genesis_entry_header_markup_open', 5);
add_action('lunarwp_entry_header', 'genesis_entry_header_markup_close', 15);
add_action('lunarwp_entry_header', 'genesis_do_post_title');
add_action('lunarwp_entry_header', 'genesis_post_info', 12);
add_filter('genesis_markup_site-inner_output', 'lunarwp\do_page_header', 10, 2);
@hellofromtonya
hellofromtonya / hideHeaderNav.js
Last active August 29, 2015 14:06
Hide header nav on homepage until reader begins scrolling down the page - Genesis framework
<script type="text/javascript">
(function($) {
$(document).ready(function () {
var headerNav = $('body.home').find('nav.nav-header');
headerNav.hide();
$(window).scroll(function(){
if ($(this).scrollTop() > 100)
{
@hellofromtonya
hellofromtonya / functions.php
Created October 24, 2014 18:11
Genesis Framework: Swap the Site Description to be before the Site Title
//* Swap the site description ahead of the site title
remove_action('genesis_site_description', 'genesis_seo_site_description');
add_action('genesis_site_title', 'genesis_seo_site_description', 1);
@hellofromtonya
hellofromtonya / spa-integration-language-form.php
Last active August 29, 2015 14:14
spa_integration_language_form() Debug & Temp Change to get language fr_FR to work
function spa_integration_language_form() {
include_once SF_PLUGIN_DIR.'/admin/library/sp-languages.php';
global $siteLang, $locale;
# Get user language setting
$siteLang = $locale;
//* var_dump($locale); // Result = 'fr_FR'
//* var_dump($siteLang); // Result = 'fr_FR'
if(!empty($siteLang)) {
@hellofromtonya
hellofromtonya / spa-integration-language-form.php
Last active August 29, 2015 14:14
force $locale when WPLANG is 'fr_FR' to set translation files to -fr.mo
# ------------------------------------------------------------------
# sp_localisation()
# Setup the forum localisation
# ------------------------------------------------------------------
function sp_localisation() {
# i18n support
global $spPaths;
$locale = get_locale();
@hellofromtonya
hellofromtonya / functions.php
Created February 2, 2015 01:37
Replace out HEX characters in WordPress attachment URL
add_filter( 'wp_get_attachment_url', 'lunarwp_modify_attachment_url', 10, 2 );
/**
* Replace out hex characters in an URL
*
* @since 1.0.0
*
* @param string $url Attachment URL
* @param integer $post_ID Optional. Attachment ID. Default 0.
* @return string Returns the amended attachment url
*/
@hellofromtonya
hellofromtonya / hooked_functions.php
Last active August 29, 2015 14:16
WordPress - Print out a list of all the hooked functions for a given tag (or all if no tag is passed). Builds a table showing rowed by priority.
/**
* An example of how to call it
*/
add_action( 'wp_head', function() {
print_list_hooked_functions( 'genesis_header' );
} );
/**
* Print a list of all hooked functions
*