Skip to content

Instantly share code, notes, and snippets.

Nuno Morais Sarmento nfsarmento

Block or report user

Report or block nfsarmento

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
@nfsarmento
nfsarmento / ns_social_sharing_buttons.php
Last active Aug 16, 2019
Social sharing shortcode buttons
View ns_social_sharing_buttons.php
function ns_social_sharing_buttons($content) {
// Get current page URL
$nsURL = urlencode(get_permalink());
// Get current page title
$nsTitle = htmlspecialchars(urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8');
// Get Post Thumbnail for pinterest
$nsThumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
@nfsarmento
nfsarmento / get-isotope-items.php
Created Aug 6, 2019 — forked from mohandere/get-isotope-items.php
jQuery isotope plugin for wordpress posts filtering by category with pagination.
View get-isotope-items.php
<?php
function get_isotope_item( $query_args = array() ){
$defaults = array(
'post_type' => 'post',
'posts_per_page' => -1,
'post_status' => 'publish',
);
View smooth-jump.js
jQuery(function( $ ){
// Jump to home-arrow id
// or remove ID to select all links with hashes
$('a[href*="#home-jump"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
location.hostname == this.hostname
@nfsarmento
nfsarmento / functions.php
Created Jun 7, 2019
Debug WordPress menu
View functions.php
/**
* Debug WordPress menu
*/
add_action( 'admin_init', 'ns_debug_admin_menu' );
function ns_debug_admin_menu() {
echo '<pre>' . print_r( $GLOBALS[ 'menu' ], TRUE) . '</pre>';
echo '<style> pre{margin-left: 240px;}</style>';
}
@nfsarmento
nfsarmento / functions.php
Created Jun 5, 2019
Allow skype URIs to be used
View functions.php
/**
* Allow skype URIs to be used
*/
if ( ! function_exists( ( 'ns_portfolio_minimal_allow_skype_protocol' ) ) ) {
function ns_portfolio_minimal_allow_skype_protocol( $protocols ) {
$protocols[] = 'skype';
return $protocols;
}
}
View functions.php
//Disable Gutenberg
add_filter( 'use_block_editor_for_post', '__return_false' );
remove_action( 'try_gutenberg_panel', 'wp_try_gutenberg_panel' );
@nfsarmento
nfsarmento / functions.php
Created May 29, 2019
How to Remove Visual Composer (WP Bakery Page Builder) meta generator
View functions.php
/**
* remove vc generator
*/
add_action('wp_head', 'ns_novcgen', 1);
function ns_novcgen() {
if ( class_exists( 'Vc_Base' ) ) {
remove_action('wp_head', array(visual_composer(), 'addMetaData'));
}
}
@nfsarmento
nfsarmento / functions.php
Created May 24, 2019 — 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
View functions.php
<?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 / functions.php
Created May 23, 2019
List All Capabilities of Current User in WordPress
View functions.php
$data = get_userdata( get_current_user_id() );
if ( is_object( $data) ) {
$current_user_caps = $data->allcaps;
// print it to the screen
echo '<pre>' . print_r( $current_user_caps, true ) . '</pre>';
}
@nfsarmento
nfsarmento / function.php
Created May 22, 2019
ACF Pro licence activation
View function.php
// wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
You can’t perform that action at this time.