Skip to content

Instantly share code, notes, and snippets.

View raewrites's full-sized avatar

Raelene Morey raewrites

View GitHub Profile
@raewrites
raewrites / mce-buttons
Created January 13, 2015 04:06
MCE Buttons
function wpb_mce_buttons_2($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'wpb_mce_buttons_2');
@raewrites
raewrites / filter-mce-settings
Created January 13, 2015 04:07
Filter MCE Settings
/*
* Callback function to filter the MCE settings
*/
function my_mce_before_init_insert_formats( $init_array ) {
// Define the style_formats array
$style_formats = array(
// Each array child is a format with it's own settings
@raewrites
raewrites / editor-style
Created January 13, 2015 04:08
Editor Style
.content-block {
border:1px solid #eee;
padding:3px;
background:#ccc;
max-width:250px;
float:right;
text-align:center;
}
.content-block:after {
clear:both;
@raewrites
raewrites / create-editor-style
Created January 13, 2015 04:08
Create Editor Style
function my_theme_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'init', 'my_theme_add_editor_styles' );
@raewrites
raewrites / my-function
Created January 16, 2015 05:54
My Function
<?php
function my_function() {
// contents of function go here
}
add_action( 'pre_get_posts', 'my_function');
?>
@raewrites
raewrites / my-function-conditional-tags
Created January 16, 2015 05:55
My Function Conditional Tags
<?php
function my_function() {
if ( !is_admin() && $query_>is_main_query() ) {
// contents of function go here
}
}
@raewrites
raewrites / get-posts
Created January 16, 2015 05:56
Get Post
<?php
function my_function() {
if ( is_home() && $query->is_main_query() ) {
$query->set( 'post_type', array( 'post', 'custom_post_type') );
return $query;
}
@raewrites
raewrites / amend-category-archives
Created January 16, 2015 05:58
Amend Category Archives
<?php
function my_function() {
if ( is_category() && $query->is_main_query() ) {
$query->set( 'post_type', 'custom_post_type' );
return $query;
}
@raewrites
raewrites / look-for-category
Created January 16, 2015 05:59
Look for Category
<?php
function my_function() {
if ( is_category( 'category-slug' ) && $query->is_main_query() ) {
$query->set( 'post_type', 'custom_post_type' );
return $query;
}
@raewrites
raewrites / display-alphabetical-order
Created January 16, 2015 05:59
Display Alphabetical Order
<?php
function my_function() {
if ( is_category() && $query->is_main_query() ) {
$query->set( 'orderby', 'title');
$query->set( 'order', 'ASC' );
return $query;
}