Skip to content

Instantly share code, notes, and snippets.

View krystyna93's full-sized avatar
🏠
Working from home

krystyna krystyna93

🏠
Working from home
  • Victoria, Australia
View GitHub Profile
@chrisguitarguy
chrisguitarguy / comments-example.php
Created September 21, 2011 21:44
How to add custom fields to WordPress comments
<?php
/*
Plugin Name: Add Extra Comment Fields
Plugin URI: http://pmg.co/category/wordpress
Description: An example of how to add, save and edit extra comment fields in WordPress
Version: n/a
Author: Christopher Davis
Author URI: http://pmg.co/people/chris
License: MIT
*/
@mikeschinkel
mikeschinkel / functions.php
Created February 3, 2012 07:43
Master WordPress Custom Post Types - WordCamp Atlanta 2012
<?php
/*
* Code Examples for Master WordPress Custom Post Types - WordCamp Atlanta 2012
*
* Author: Mike Schinkel
* Author URI: http://about.me/mikeschinkel
*
*/
add_action( 'init', 'mikes_theme_init' );
function mikes_theme_init() {
@daltonrooney
daltonrooney / file-upload-handler.php
Created February 4, 2012 13:29
Multi-file WordPress uploads from the front-end
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@luetkemj
luetkemj / wp-query-ref.php
Last active September 14, 2024 13:06
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@markreale
markreale / display_custom_fields.php
Created May 31, 2012 05:29
Conditionally Displaying Custom Fields with WordPress
/****************************************************************
* *
* Conditional statement to retrieve content based on the *
* existence of a Custom Field. *
* If the Custom Field exists, display the content of the *
* Custom Field (can be adjusted to display alternate content). *
* *
****************************************************************/
// Check for existence of content in that custom field
@foxinni
foxinni / better wp_dropdown_categories() for taxonomies
Created June 13, 2012 07:47
Modify wp_dropdown_categories() to support taxonomy->slug in select output, and not taxonomy->id.
<?php
/*
Background: My company post type needed a filter added via the 'restrict_manage_posts' action, and I needed to modify the wp_dropdown_categories to output the taxonomy slug into the <option value="..."> instead of the taxonomy ID. The taxonomy being 'industry'.
The SH_Walker_TaxonomyDropdown() can be found here: https://gist.github.com/2902509
*/
function restrict_listings_by_taxonomy() {
global $typenow;
global $wp_query;
@i-like-robots
i-like-robots / functions.php
Created August 21, 2012 10:01
Wordpress custom comment form
<?php
/**
* Comment form hidden fields
*/
function comment_form_hidden_fields()
{
comment_id_fields();
if ( current_user_can( 'unfiltered_html' ) )
{
@arod2634
arod2634 / custom-wp-dashboard.php
Created September 21, 2012 02:50
Customize Wordpress Admin Dashboard
<?php
//Add a custom admin dashboard welcome widget
function custom_dashboard_widget() {
echo '<h1>Welcome to your new WordPress site built by an awesome developer</h1>';
}
function add_custom_dashboard_widget() {
wp_add_dashboard_widget('custom_dashboard_widget', 'Integrity Welcomes You To WordPress!', 'custom_dashboard_widget');
}
add_action('wp_dashboard_setup', 'add_custom_dashboard_widget');
@melissacabral
melissacabral / wp-dimox-breadcrumbs.php
Last active February 17, 2022 09:13
breadcrumbs - place in functions.php and call in your theme with dimox_breadcrumbs() [Source](http://dimox.net/wordpress-breadcrumbs-without-a-plugin/)
<?php
/**
* Dimox Breadcrumbs
* http://dimox.net/wordpress-breadcrumbs-without-a-plugin/
* Since ver 1.0
* Add this to any template file by calling dimox_breadcrumbs()
* Changes: MC added taxonomy support
*/
function dimox_breadcrumbs(){
/* === OPTIONS === */