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 / index.php
Last active Feb 28, 2020 — forked from rbk/index.php
Turn input placeholders into floating labels for WP Contact Form 7 fields
View index.php
/*
*
* Description: Adds floating lables to all text inputs
*
*/
function ns_append_style_and_js( ){ ?>
<script type="text/javascript">
jQuery(document).ready(function($){
$(document).on('focus', 'input[type=text], input[type=email], textarea', function(e){
var ph = $(this).attr('placeholder');
@nfsarmento
nfsarmento / functions.php
Created Feb 26, 2020 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
View functions.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@nfsarmento
nfsarmento / wordpress.conf
Created Feb 25, 2020
Harden wordpress security nginx
View wordpress.conf
############ WordPress ####################
location @empty {
empty_gif;
}
# Limit access to avoid brute force attack
# if you getting error please add this (limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;) to your /etc/nginx/nginx.conf
# location = /wp-login.php {
# limit_req zone=one burst=1 nodelay;
@nfsarmento
nfsarmento / WordPress PopUp login form.css
Last active Feb 14, 2020
WordPress: PopUp login form
View WordPress PopUp login form.css
/************** Login popup form *************/
form#login_popup {
background-color: #ffffff;
color: #000;
display: none;
left: 50%;
margin-left: -197px;
padding: 40px 25px 25px;
position: fixed;
top: 100px;
@nfsarmento
nfsarmento / content.php
Created Feb 13, 2020
NS Minimal WordPress Theme - First post in full, others show excerpts
View content.php
<?php
/**
* The template used for displaying content
*
* @package ns-minimal
* @since ns-minimal 1.0.0
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
@nfsarmento
nfsarmento / .htaccess
Created Feb 6, 2020
Getting Media on Your Local WordPress Site
View .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^wp-content/uploads(.*)$ https://www.nuno-sarmento.com/wp-content/uploads/$1 [L,R]
@nfsarmento
nfsarmento / Embed Gists with a URL on WordPress editor.php
Last active Feb 6, 2020
Embed Gists with a URL on WordPress editor
View Embed Gists with a URL on WordPress editor.php
/**
* Embed Gists with a URL on WordPress editor.
*
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/106134890a362a2a872055401f7fe743
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/106134890a362a2a872055401f7fe743?file=embed-gist.php
*
@nfsarmento
nfsarmento / Extend Recent Posts Widget.php
Created Feb 5, 2020
Extend Recent Posts Widget with Thumbnail Image and others
View Extend Recent Posts Widget.php
/**
* Extend Recent Posts Widget
*
* Adds different formatting (images) to the default WordPress Recent Posts Widget
*/
Class Ns_Recent_Posts_Widget extends WP_Widget_Recent_Posts {
function widget($args, $instance) {
@nfsarmento
nfsarmento / popular-widget.php
Last active Feb 5, 2020 — forked from billerickson/gist:1888923
Popular Posts Widget
View popular-widget.php
@nfsarmento
nfsarmento / breadcrumb.php
Last active Jan 30, 2020 — forked from timnovis/breadcrumb.php
WordPress Breadcrumbs & Schema Markup
View breadcrumb.php
<?php
/**
* Breadcrumbs
*
* @package nunosarmento
*/
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
You can’t perform that action at this time.