Skip to content

Instantly share code, notes, and snippets.

View barbwiredmedia's full-sized avatar

Barbara Talbot barbwiredmedia

View GitHub Profile
@barbwiredmedia
barbwiredmedia / functions.php
Last active August 29, 2015 13:56
Wordpress -3.8 wysiwyg change options available to your user mce options. (colors, HEX, tags) Add more buttons to tiny mce (hr,sup,) (This no longer works in Wordpress 3.9+) Controls: http://www.tinymce.com/wiki.php/Controls
// change buttons in WYSWIG post editor, edit color palette
function change_mce_options( $init ) {
$init['theme_advanced_blockformats'] = 'p,address,h2,h3,h4,h5,h6,'; // add tag you want to be available (h1,pre,code)
$init['theme_advanced_disable'] = ''; // includes numlist,blockquote,justifyright,justifycenter,pasteword,pastetext etc.
$init['theme_advanced_text_colors'] = 'FF00FF,FFFF00,000000'; //add your themes colors here
$init['theme_advanced_more_colors'] = false;
return $init;
}
add_filter('tiny_mce_before_init', 'change_mce_options');
@barbwiredmedia
barbwiredmedia / wp_pagenavi.php
Created March 26, 2014 17:10
Wordpress Pagenavi Enable pagination for custom post types with a loop or wpquery
<?php
// Must have wp_pagenavi plugin installed. Custom Post Type names can not clash with page names or 404's will occur on /page/#/ (Utilize Custom Rewrite Slug in CPT)
// The press release loop
$the_press = new WP_Query(array('post_type' => 'press-releases','posts_per_page' => 10,'paged'=> get_query_var('paged') ));
// The Loop
while ($the_press->have_posts()) : $the_press->the_post();
?>
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
@barbwiredmedia
barbwiredmedia / xampp.txt
Created May 1, 2014 22:35
Open XAMPP Windows to internal network. On http-xampp.conf add "Allow from all" after line 130 You will be able to acess directory from network IP. WIll have to restart server.
# Close XAMPP sites here
<LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8
Allow from all
ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
</LocationMatch>
http://stackoverflow.com/questions/6083323/error-when-trying-to-access-xampp-from-a-network
@barbwiredmedia
barbwiredmedia / has_terms.php
Created May 6, 2014 21:12
Wordpress has term, categories, taxomomy. Can be used in the loop or wp_query where your_taxonomy_name = the custom taxonomy name and a_term_name is a created term
<?php if (has_term('a_term_name', 'your_taxonomy_name')): ?>
//stuff here
<?php elseif (has_term('another_term_name', 'your_taxonomy_name')): ?>
//stuff
<?php endif; ?>
// get taxonomies terms links
function custom_taxonomies_terms_links(){
// get post by post id
$post = get_post( $post->ID );
// get post type by post
$post_type = $post->post_type;
// get post type taxonomies
$taxonomies = get_object_taxonomies( $post_type, 'objects' );
@barbwiredmedia
barbwiredmedia / if_feild.php
Last active August 29, 2015 14:01
ACF Advanced custom fields output field only if exists. Check if field exists and has content.
<?php if (get_field('your_field')): ?>
<?php the_field('your_field'); ?>
<?php endif; ?>
<!-- Else example -->
<?php if (get_field('your_field')) : ?>
<?php the_field('your_field'); ?>
<?php else : ?>
<!--alternate stuff-->
@barbwiredmedia
barbwiredmedia / selector.php
Last active August 29, 2015 14:01
ACF advanced custom fields select in a repeater field to choose content layout or, anything else, within a wordpress page.
<?php if (get_field('page_content_repeater')) { ?>
<?php while (the_repeater_field('page_content_repeater')): ?>
<?php
/* Pull from users select choice in ACF */
$choice1 = 'string_1';
$choice2 = 'string_2';
?>
<?php if (get_sub_field('your_selection_field') === $choice1) { ?>
<!--Your Content-->
@barbwiredmedia
barbwiredmedia / col-reset.php
Last active August 29, 2015 14:01
Bootstrap Responsive column resets. Clear columns without rows. For use within looped content where you can't inject more markup. http://getbootstrap.com/css/#grid
<!--Example #1-->
<?php //Your Loop Start?>
<div class="row your-wrapper">
<div class="col-md-6">
<!--Your stuff with 50% columns-->
</div>
<div class="duel-clear clearfix"></div>
</div>
<?php //Your Loop END?>
@barbwiredmedia
barbwiredmedia / carousel.css
Last active August 29, 2015 14:02
Bootstrap Carousel. Add fade animation between slides (Does not work in - IE9) http://www.bootply.com/86170
@barbwiredmedia
barbwiredmedia / index.html
Created June 24, 2014 23:26
Meta Viewport for mobile
<!--Static width site for mobile
width=size of site-->
<meta name="viewport" content="width=950">