Skip to content

Instantly share code, notes, and snippets.

View MassimilianoRa's full-sized avatar

Massimiliano Raggi MassimilianoRa

View GitHub Profile
@MassimilianoRa
MassimilianoRa / Angular JS Basic Example
Last active July 30, 2017 10:16
Angular JS Basic Example
<!doctype html>
<!-- Declaring the ng-app -->
<html ng-app="parking">
<head>
<title>Parking</title>
<!-- Importing the angular.js script -->
<script src="angular.js"></script>
<script>
// Creating the module called parking
var parking = angular.module("parking", []);
@MassimilianoRa
MassimilianoRa / .htaccess
Created July 5, 2017 08:33
Wordpress We block spam on our blog
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post.php*
RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]
</ifmodule>
@MassimilianoRa
MassimilianoRa / functions.php
Last active July 5, 2017 08:17
Wordpress tag cloud style
add_filter(‘widget_tag_cloud_args’,’style_tags’);
function style_tags($args) {
$args = array(
‘largest’ => ’10’,
‘smallest’ => ’10’,
‘format’ => ‘list’,
);
return $args;
@MassimilianoRa
MassimilianoRa / future-article.php
Last active July 5, 2017 08:14
WordPress View articles with a future date
<?php
$pq = 'post_status=future&order=DESC&showposts=5';
$prox = new WP_Query($pq);
if ($prox->have_posts()) { ?>
<ul>
<?php
while ($prox->have_posts()) : $prox->the_post();
$unico = $post->ID;
?>
<li><?php the_title(); ?> (<?php the_time('j F Y'); ?>)</li>
@MassimilianoRa
MassimilianoRa / wp-config.php
Last active July 5, 2017 08:06
WordPress limit post revision
define('WP_POST_REVISIONS', '3'); // To limit the number of revisions to 3 (you can set any number of revisions).
@MassimilianoRa
MassimilianoRa / wp-config.php
Last active July 5, 2017 08:07
Activate WordPress post revision
define(‘WP_POST_REVISIONS’, true); // To keep revisions active.
@MassimilianoRa
MassimilianoRa / wp-config.php
Last active July 5, 2017 08:07
Disable Wordpress post revision
define('WP_POST_REVISIONS', false); // To completely disable revisions.
@MassimilianoRa
MassimilianoRa / login.php
Created July 5, 2017 07:58
WordPress: Custom login page step.3
<?php
/*
Template Name: Login Page
*/
?>
<?php get_header(); ?>
<div id=”login-form”>
<h2><?php the_title(); ?></h2>
<form name=”loginform” id=”loginform” action=”<?php echo get_option(‘home’); ?>/wp-login.php” method=”post”>
@MassimilianoRa
MassimilianoRa / login.php
Last active July 5, 2017 07:59
WordPress: Custom login page step.2
<?php
/*
Template Name: Login Page
*/
?>
<?php get_header(); ?>
<div id=”login-form”>
<!– qui il vostro codice per il login-form–>
</div>
<?php get_sidebar(); ?>
@MassimilianoRa
MassimilianoRa / login.php
Created July 5, 2017 07:51
WordPress: Custom login page step.1
<?php
/*
Template Name: Login Page
*/
?>