Skip to content

Instantly share code, notes, and snippets.

Giraldi Maggio gmaggio

Block or report user

Report or block gmaggio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gmaggio
gmaggio / table-date-range.php
Created Mar 16, 2016
Programmatically create table that contains rowspan to distinguish date range based on month.
View table-date-range.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Table with date range</title>
<script type="text/javascript">
</script>
View sql-related-post-by-relevancy.sql
# Note: Higher number equals higher priority
# to indicate greater relevancy
SELECT *,
(CASE WHEN attribute1_field = attribute1_value THEN 2 ELSE 0 END) +
(CASE WHEN attribute2_field = attribute2_value THEN 1 ELSE 0 END) +
(CASE WHEN attribute3_field = attribute3_value THEN 1 ELSE 0 END) AS priority
FROM table_post
WHERE (
attribute1_field = attribute1_value
@gmaggio
gmaggio / wp-admin-dashboard-items-remove.php
Created Aug 10, 2014
[Wordpress] Remove Unwanted Dashboard Items
View wp-admin-dashboard-items-remove.php
<?php
/**
* Remove Unwanted Dashboard Items
*
* Source:
* Point #25 @ https://managewp.com/enhanced-performance-code-snippets
*
*/
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
function my_custom_dashboard_widgets() {
View wp-admin-newpage-set-menuorder-1.php
<?php
/**
* Automatically set Menu Order on create new page
*
* Source:
* http://wordpress.stackexchange.com/a/155979/1044
*
*/
add_action( 'admin_footer-post-new.php', 'my_admin_footer_post_new_php' );
View wp-admin-pages-orderby-menuorder.php
<?php
/**
* Order Admin Pages by Menu Order by Default
*
* Source:
* http://wordpress.org/support/topic/sort-pages-by-date-in-admin-by-default?replies=4#post-5380257
*
*/
add_filter('pre_get_posts', 'my_set_post_order_in_admin' );
@gmaggio
gmaggio / wp-post-twitter-fb-share.php
Created Jul 26, 2014
[Wordpress] Add Twitter & Facebook share buttons to posts
View wp-post-twitter-fb-share.php
<?php
add_action('the_content', 'my_share_this');
/**
* Add Twitter & Facebook share buttons to posts
*
* Sources:
* - http://wordpress.stackexchange.com/questions/125838/how-to-create-really-simple-wordpress-custom-buttons-for-print-facebook-share-a
* - http://www.catswhocode.com/blog/wordpress-snippets-to-interact-with-social-networks
*
*/
@gmaggio
gmaggio / wp-menu-item-name.php
Created Jul 26, 2014
[Wordpress] Get the Menu Name of the current page
View wp-menu-item-name.php
<?php
/**
* Get the Menu Name of the current page
*
* $loc is the location name of the nav menu
*
* Source:
* http://wordpress.stackexchange.com/a/155833/1044
*
*/
@gmaggio
gmaggio / wp-page-subpage-menu.php
Created Jul 25, 2014
[Wordpress] Display Child Pages on the Parent Page (including the Parent Page itself)
View wp-page-subpage-menu.php
<?php
/**
* Display Child Pages on the Parent Page
* (including the Parent Page itself)
*
* Sources:
* - http://codex.wordpress.org/Function_Reference/wp_list_pages
* - http://www.wpbeginner.com/wp-tutorials/how-to-display-a-list-of-child-pages-for-a-parent-page-in-wordpress/
* - http://www.svennerberg.com/2009/02/creating-a-submenu-in-wordpress/
*/
@gmaggio
gmaggio / wp-add-class-next_prev_post_links.php
Created Jul 20, 2014
[Worpress] Add class to next/previous post links (Add class to links generated by next_posts_link & previous_posts_link)
View wp-add-class-next_prev_post_links.php
<?php
/**
* Add class to next/previous post links
*
* Add class to links generated by next_posts_link
* and previous_posts_link
*/
if ( ! function_exists( 'posts_link_attributes_prev' ) || ! function_exists( 'posts_link_attributes_next' ) ) {
function posts_link_attributes_prev() {
@gmaggio
gmaggio / jquery-row-height-equal.js
Created Jul 19, 2014
[jQuery] Equal Height Rows - Responsive
View jquery-row-height-equal.js
/**
* Equal Height Rows - Responsive
*
* Source:
* http://codepen.io/micahgodbolt/pen/FgqLc?editors=101
* http://css-tricks.com/equal-height-blocks-in-rows/
*
*/
equalheight = function(container){
You can’t perform that action at this time.