Skip to content

Instantly share code, notes, and snippets.

@thedavedavies
thedavedavies / get-first-paragraph.php
Last active October 13, 2016 13:17 — forked from banago/get-fisrt-paragraph.php
Get first paragraph from a WordPress post.
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @return string
*/
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
@thedavedavies
thedavedavies / ContactForm.md
Created August 28, 2018 11:00 — forked from patotoma/ContactForm.md
secure php contact form

Secured PHP Contact Form

<?php
  if(isset($_POST['submit'])){
    $name = htmlspecialchars(stripslashes(trim($_POST['name'])));
    $subject = htmlspecialchars(stripslashes(trim($_POST['subject'])));
    $email = htmlspecialchars(stripslashes(trim($_POST['email'])));
    $message = htmlspecialchars(stripslashes(trim($_POST['message'])));
    if(!preg_match("/^[A-Za-z .'-]+$/", $name)){
// Based on: https://rudrastyh.com/instagram/get-photos-and-profile-info-pure-javascript.html
<div class="row row-insta"></div>
<script type="text/javascript">
const token = 'xxxxxx-xxxxxx-xxxxxx', // API Token Goes Here
num_photos = 6, // maximum 20
container = document.querySelector( '.row-insta' ),
scrElement = document.createElement( 'script' );
window.getResult = function( data ) {