This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Enqueue scripts and styles | |
*/ | |
function your_theme_enqueue_scripts() { | |
// all styles | |
wp_enqueue_style( 'bootstrap', get_stylesheet_directory_uri() . '/css/bootstrap.css', array(), 20141119 ); | |
wp_enqueue_style( 'theme-style', get_stylesheet_directory_uri() . '/css/style.css', array(), 20141119 ); | |
// all scripts | |
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '20120206', true ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import queryString from 'query-string'; | |
import { getSpinner } from './components'; | |
/** | |
* Implementation Example at the very bottom. | |
*/ | |
export default function( settings ) { | |
let page = 2; | |
let buttonContent; | |
let headers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Define our Custom Post Type | |
function dwwp_register_post_type() { | |
//Add a filter to our $singular variable. | |
$singular = apply_filters( 'dwwp_label_single', 'Book' ); | |
//Add a filter to our $plural variable. | |
$plural = apply_filters( 'dwwp_label_plural', 'Books' ); | |
$labels = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dwwp_register_taxonomy() { | |
$singular = 'Location'; | |
$plural = 'Locations'; | |
$slug = str_replace( ' ', '_', strtolower( $singular ) ); | |
$labels = array( | |
'name' => $plural, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Exit if accessed directly | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} | |
function dwwp_register_post_type() { | |
$singular = 'Job'; | |
$plural = 'Jobs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dwwp_remove_dashboard_widgets() { | |
remove_meta_box( 'dashboard_primary', 'dashboard', 'post_container_1' ); | |
} | |
add_action( 'wp_dashboard_setup', 'dwwp_remove_dashboard_widgets' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function register_user_question_content_type() { | |
$post_labels = array( | |
'name' => 'User Questions', | |
'singular_name' => 'User Question', | |
'add_new' => 'Add New', | |
'add_new_item' => 'Add New User Question', | |
'edit' => 'Edit', | |
'edit_item' => 'Edit User Question', | |
'new_item' => 'New User Question', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* This function will return all the image data (id, url) | |
* @param $post_id int The post id. | |
* @param $name string the name of your custom field you used when creating the field. | |
* | |
* @return mixed | |
*/ | |
function get_custom_upload( $post_id, $name ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wp_code_context() { | |
$theme = strpos( __DIR__, 'themes' ); | |
return ( $theme ) ? 'theme' : 'plugin'; | |
} | |
function get_directory_by_context() { | |
$context = wp_code_context(); | |
switch( $context ) { | |
case 'theme': | |
$local_dir = get_template_directory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function dwwp_add_google_link() { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'id' => 'google_analytics', | |
'title' => 'Google Analytics', | |
'href' => 'http://google.com/analytics/' | |
) ); |
NewerOlder