Skip to content

Instantly share code, notes, and snippets.

View nfsarmento's full-sized avatar

NS nfsarmento

View GitHub Profile
@nfsarmento
nfsarmento / is_blog.php
Created August 9, 2017 17:58 — forked from wesbos/is_blog.php
WordPress is_blog()
function is_blog () {
global $post;
$posttype = get_post_type($post );
return ( ((is_archive()) || (is_author()) || (is_category()) || (is_home()) || (is_single()) || (is_tag())) && ( $posttype == 'post') ) ? true : false ;
}
Usage:
<?php if (is_blog()) { echo 'You are on a blog page'; } ?>
@nfsarmento
nfsarmento / simple-map-defer.php
Created December 12, 2017 12:46 — forked from glueckpress/simple-map-defer.php
[WordPress][Simple Map] Load Google Maps API script from Simple Map deferred.
<?php
defined( 'ABSPATH' ) or die( 'No direct access here.' );
/**
* Plugin Name: Simple Map | Defer
* Description: Makes sure Google Maps API script from <a href="https://wordpress.org/plugins/simple-map/">Simple Map</a> gets loaded deferred.
* Author: Caspar Hübinger
* Author URI: https://profiles.wordpress.org/glueckpress
* Plugin URI: https://gist.github.com/glueckpress/56c88900aad391b95b5d44f4e752a1a4
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
@nfsarmento
nfsarmento / php7.1.md
Last active January 31, 2018 08:45 — forked from VirtuBox/php7.1.md
How to install php7.1-fpm with EasyEngine

How to install php7.1-fpm with EasyEngine


Install php7.1-fpm

apt install php7.1-common php7.1-cli php7.1-zip php7.1-opcache php7.1-mysql php7.1-mcrypt php7.1-mbstring php7.1-json php7.1-intl php7.1-gd php7.1-fpm php7.1-curl php7.1-bz2

Copy the php7.1-fpm pool configuration from php7.0-fpm

cp -f /etc/php/7.0/fpm/pool.d/www.conf /etc/php/7.1/fpm/pool.d/www.conf
@nfsarmento
nfsarmento / a-theme-auth.php
Created January 31, 2018 19:55 — forked from itzikbenh/a-theme-auth.php
WordPress class for registering users via Linkedin
<?php
function a_theme_auth_options_page()
{
add_options_page( "A-Theme Auth options", "A-Theme Auth", "manage_options", "a-theme-auth", "a_theme_auth_options" );
}
add_action( 'admin_menu', 'a_theme_auth_options_page' );
function register_a_theme_auth_settings()
{
@nfsarmento
nfsarmento / functions.php
Last active August 8, 2018 16:52 — forked from bmoredrew/gist:dcc7d04b23e785f6c0bb
Front-end Attendee List WooCommerce WooTickets Events Calendar Plugin
<?php
global $current_user;
get_currentuserinfo();
if (is_user_logged_in() && $current_user->ID == $post->post_author) {
// Build a list of attendees
$attendeeList = TribeEventsTickets::get_event_attendees($event_id);
$customerList = array();
@nfsarmento
nfsarmento / .htaccess
Created September 5, 2018 15:25 — forked from Zodiac1978/.htaccess
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
#
@nfsarmento
nfsarmento / functions.php
Created May 24, 2019 13:30 — forked from vicskf/functions.php
Event Tickets > Send a copy of the RSVP or ticket email to all event organizers that have a valid email address
<?php
/**
* BCC event organizers email on all Event Tickets' RSVP and commerce ticket emails so they get a copy of it too
*/
function bcc_all_event_organizers( $headers, $event_id, $order_id ) {
//check if has organizer
if ( !tribe_has_organizer( $event_id ) ) {
return $headers;
}
@nfsarmento
nfsarmento / get-isotope-items.php
Created August 6, 2019 15:49 — forked from mohandere/get-isotope-items.php
jQuery isotope plugin for wordpress posts filtering by category with pagination.
<?php
function get_isotope_item( $query_args = array() ){
$defaults = array(
'post_type' => 'post',
'posts_per_page' => -1,
'post_status' => 'publish',
);
@nfsarmento
nfsarmento / breadcrumb.php
Last active January 26, 2024 17:26 — forked from timnovis/breadcrumb.php
WordPress Breadcrumbs & Schema Markup
<?php
/**
* Breadcrumbs
*
* @package nunosarmento
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
@nfsarmento
nfsarmento / popular-widget.php
Last active February 5, 2020 17:35 — forked from billerickson/gist:1888923
Popular Posts Widget