Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block domantasg

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
View stop_heartbeat()
add_action( 'init', 'stop_heartbeat', 1 );
function stop_heartbeat() {
View gmail.phps
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
View add_reviews_to_frontpage
/ Hook our custom function to the pre_get_posts action hook
add_action( 'pre_get_posts', 'add_reviews_to_frontpage' );
// Alter the main query
function add_reviews_to_frontpage( $query ) {
if ( is_home() && $query->is_main_query() ) {
$query->set( 'post_type', array( 'post', 'movie', 'review' ) );
return $query;
View Displaying Advanced Custom Fields
// Display field value
the_field( 'FIELD NAME' );
// Return field value
get_field( 'FIELD NAME' );
View get_post_meta()
$movie_box_art = get_post_meta( $post->ID, 'Box Art', TRUE );
if (!empty($movie_box_art)) { ?>
<div class="movie-poster-box">
<img src="<?php echo $movie_poster ?>" alt="<?php single_post_title(); ?> ">
<? } ?>
View the_meta()
<ul class='post-meta'>
<span class='post-meta-key'>{your_key}</span> {your_value}
View gist:0fdb1772e16c6aa402192b2a20c62634
// Generates all custom fields attached to the post in a <ul> list
// Get a specific piece of information
echo get_post_meta( $post->ID, 'Budget', TRUE );
View WordPress New Custom Post Type
Plugin Name: My Custom Post Types
Description: Add post types for movies and movie reviews
Author: Liam Carberry
// Hook <strong>lc_custom_post_movie()</strong> to the init action hook
add_action( 'init', 'lc_custom_post_movie' );
View WordPress New Post Type
// The custom function MUST be hooked to the init action hook
add_action( 'init', 'lc_register_movie_post_type' );
// A custom function that calls register_post_type
function lc_register_movie_post_type() {
// Set various pieces of text, $labels is used inside the $args array
$labels = array(
'name' => _x( 'Movies', 'post type general name' ),
'singular_name' => _x( 'Movie', 'post type singular name' ),
View WordPress functions.php Example
* Global Functions
// Remove 'auto-paragraphing' from posts/pages
remove_filter( 'the_content', 'wpautop' );
* Admin Control Panel Functions
You can’t perform that action at this time.