Skip to content

Instantly share code, notes, and snippets.

@sosukeinu
sosukeinu / wp_auto_thumbnail_functions.php
Created January 29, 2013 16:07
WP function auto featured image
<?php
/*
* This function will get the first image in this order:
*
* 1) Featured image
* 2) First image attached to post
* 3) First image URL in the content of the post
* 4) YouTube screenshot
* 5) Default images for different categories [SET MANUALLY]
@tinotriste
tinotriste / breadcrumbs-functions.php
Last active March 25, 2025 12:59
Wordpress: Breadcrumbs function
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';
@sniperwolf
sniperwolf / ajax.php
Last active December 29, 2022 12:25
Super-Simple WordPress ajax post-popup with jQuery and Reveal plugin
<?php
/**
* Template Name: ajax
*/
?>
<?php
$post = get_post($_GET['id']);
?>
<?php if ($post) : ?>
<?php setup_postdata($post); ?>
<?php
/*
* WordPress Breadcrumbs
* author: Dimox
* version: 2019.03.03
* license: MIT
*/
function dimox_breadcrumbs() {
/* === OPTIONS === */
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active March 27, 2025 08:16
A badass list of frontend development resources I collected over time.
@tylerreed
tylerreed / wp_video_thumbnails.php
Last active March 11, 2022 02:19
A snippet of code to create static featured images for a WordPress post using a YouTube or Vimeo video URL. I have used this code for several projects where video posts or embedded videos needed to be static images in order to be more mobile friendly as well as for improve page load times when used as a featured image for the post.
<?php
/*
A snippet of code to create static featured images for a WordPress post using
a YouTube or Vimeo video URL. I have used this code for several projects where
video posts or embedded videos needed to be static images in order to be more
mobile friendly as well as for improved page load times when used as a featured
image for the post.
I have added comments where it might be neccessary to modify the code or where
there is room for improvement. There are two primary functions to be used
@spigists
spigists / new_gist_file.css
Created October 2, 2013 16:16
Bootstrap 3 styles for Gravity Forms, make sure that in Forms > Settings you have Output CSS set to No and Output HTML5 set to Yes
.gform_wrapper ul {
padding-left: 0;
list-style: none; }
.gform_wrapper li {
margin-bottom: 15px; }
.gform_wrapper form {
margin-bottom: 0; }
@hansspiess
hansspiess / template-contact.php
Created October 3, 2013 19:42
Wordpress: Simple Contact Form
<?php
/*
Template Name: Kontakt
*/
?>
<?php /* other template code goes here... */ ?>
<?php
@franz-josef-kaiser
franz-josef-kaiser / ajax.js
Last active September 5, 2024 01:43
AJAX in WordPress. Class based example.
( function( $, plugin ) {
"use strict";
// Working with promises to bubble event later than core.
$.when( someObjectWithEvents ).done( function() {
console.log( 'AJAX request done.' );
} )
.then( function() {
setTimeout( function() {
console.log( 'AJAX requests resolved.' );
@yangshun
yangshun / youtube-vimeo-url-parser.js
Last active June 14, 2023 22:27
YouTube Vimeo URL Parser
function parseVideo (url) {
// - Supported YouTube URL formats:
// - http://www.youtube.com/watch?v=My2FRPA3Gf8
// - http://youtu.be/My2FRPA3Gf8
// - https://youtube.googleapis.com/v/My2FRPA3Gf8
// - Supported Vimeo URL formats:
// - http://vimeo.com/25451551
// - http://player.vimeo.com/video/25451551
// - Also supports relative URLs:
// - //player.vimeo.com/video/25451551