Skip to content

Instantly share code, notes, and snippets.

View fernandiez's full-sized avatar

Fernan fernandiez

View GitHub Profile
@neilgee
neilgee / category-tag.php
Last active August 29, 2015 14:00
Add Category Heading to Each Page in Pagination in Genesis
<?php
//do not copy the opening php tag above
/**
* Add Category and Tag Heading to Each Page in Pagination
*
* @package Category and Tag Headings on all archive pages
* @author Neil Gee
* @link http://coolestguidesontheplanet.com/displaying-category-headings-category-archive-pages-genesis/
* @copyright (c) 2014, Neil Gee
@alfonsosiloniz
alfonsosiloniz / clean_hacked_WP.txt
Last active August 29, 2015 14:04
Clean hacked WordPress installation
When your WordPress installation is hacked, you can ussually see that the first line on every php file is modified, permitting the execution of malicious code. You will see something like this:
<?php $vixtqowrfp = 'c%x78e%x5c%x78b%x5c%x7825gc%x7825ggg)(0)%x5c%x782f+*0f(-!#]y76]277]y72]265....[]...?>[Legitimate code]
in every php file (wp-config.php for instance)
It is difficult to clean this unless you have a complete backup of your installation. If you have shell access to your hosting or server, you can clean it following these commands
Be sure every php file is infected. If not, some legitimate code could be affected, because first line is deleted in every file with this procedure.
@renventura
renventura / print-category-title-description.php
Last active August 29, 2015 14:13
Prints a category's title and description in Genesis
<?php //* Mind this opening PHP tag
/**
* Prints a category's title and description (no markup added)
*
* @author Ren Ventura
* @link http://www.engagewp.com/how-to-display-category-name-description-genesis/
*/
add_action( 'genesis_before_content', 'rv_output_category_info' );
<?php
global $post;
$get_posts = tribe_get_events(array('posts_per_page'=>-3,) );
foreach($get_posts as $post) { setup_postdata($post);
?>
<?php if ( has_post_thumbnail() ) { ?>
// Get all events from 1 week before the present date to 1 week in the future
$events = tribe_get_events( array(
'start_date' => date( 'Y-m-d H:i:s', strtotime( '-1 week' ) ),
'end_date' => date( 'Y-m-d H:i:s', strtotime( '+1 week' ) ),
'eventDisplay' => 'custom',
'posts_per_page' => -1
));
@spigotdesign
spigotdesign / gist:5980046
Created July 11, 2013 22:54
Tribe Events WP_Query for today's events
<?php $current_date = date("Y-m-d H:i:s"); ?>
<?php $efeed = new WP_Query( array(
'post_type' => 'tribe_events',
'showposts' => 10,
'eventDisplay' => 'custom',
'start_date' => $current_date,
'end_date' => $current_date
));
?>
@bentasm1
bentasm1 / functions.php
Last active June 24, 2016 09:42
Redirect Vendors to Vendor Dashboard @ login
/* Redirect Vendors to Vendor Dashboard on Login */
add_filter('woocommerce_login_redirect', 'login_redirect', 10, 2);
function login_redirect( $redirect_to, $user ) {
// WCV dashboard -- Uncomment the 3 lines below if using WC Vendors Free instead of WC Vendors Pro
// if (class_exists('WCV_Vendors') && WCV_Vendors::is_vendor( $user->id ) ) {
// $redirect_to = get_permalink(WC_Vendors::$pv_options->get_option( 'vendor_dashboard_page' ));
// }
// WCV Pro Dashboard
@bentasm1
bentasm1 / functions.php
Last active July 10, 2016 16:28
WC Vendors - Notify anyone registering in WooCommerce on Checkout or My Account Page about strong password requirement.
OPTION 1 - Add a warning that you need a stronger password.
/* WC Vendors - Add a "Need a strong password" notice to the My Account Page */
add_action( 'woocommerce_register_form', 'wcvendors_notify_password_myaccount' );
function wcvendors_notify_password_myaccount() {
echo '<strong>Important</strong> -- This site respects your security. We require all new members to use a strong password. If you can not click the Register button, <strong>you need a stronger password</strong>.<br><br>';
}
/* WC Vendors - Add a "Need a strong password" notice to the Checkout Page */
add_action( 'woocommerce_after_checkout_registration_form', 'wcvendors_notify_password_checkout' );
function wcvendors_notify_password_checkout() {
@KFleeger
KFleeger / enews.css
Last active September 27, 2016 15:51
Styles to add to a genesis child theme to create a horizontal opt-in for the enews extended plugin.
/*
Enews Plugin
-----------------------------------------------------------------*/
.home-cta .enews p {
width: 50%;
float: left;
clear: none;
font-size: 28px;
margin-right: 4%;
@srikat
srikat / functions.php
Created December 5, 2014 11:46
Horizontal Opt-in Form in Genesis using eNews Extended plugin. http://sridharkatakam.com/horizontal-opt-form-genesis-using-enews-extended-plugin/
//* Register Horizontal Opt-In widget area
genesis_register_sidebar(
array(
'id' => 'horizontal-opt-in',
'name' => __( 'Horizontal Opt-In' ),
'description' => __( 'This is the widget area for horizontal opt-in form.' ),
) );
//* Display Horizontal Opt-In below Header
add_action( 'genesis_after_header', 'sk_horizontal_opt_in' );