Skip to content

Instantly share code, notes, and snippets.

View pixelstorm's full-sized avatar

pixelstorm pixelstorm

View GitHub Profile
@pixelstorm
pixelstorm / gravity forms shortcode
Last active August 25, 2024 00:11
gravity forms cheatsheet
[gravityform id=1 title=false description=false ajax=true tabindex=49]
@pixelstorm
pixelstorm / wp snippet child theme header code and enqueue script
Last active May 14, 2019 08:41
child theme header code and function to load style sheet
/*
Theme Name: Custom Child theme
Theme URI: http://example.com/twenty-fifteen-child/
Description: Custom Theme Child Theme
Author: Daniel Florido
Author URI: http://pixelstorm.com.au
Template: parent theme
Version: 1.0.0
*/
@pixelstorm
pixelstorm / register_multiple_sidebars.php
Created June 1, 2018 01:29
register multiple sidebars
<?php
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => 'sidebar 1',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2>',
'after_title' => '</h2>'
@pixelstorm
pixelstorm / form_field_placeholders.css
Created June 1, 2018 01:11
style form field placeholders
::-webkit-input-placeholder { /* Chrome/Opera/Safari */
color: pink;
}
::-moz-placeholder { /* Firefox 19+ */
color: pink;
}
:-ms-input-placeholder { /* IE 10+ */
color: pink;
}
:-moz-placeholder { /* Firefox 18- */
@pixelstorm
pixelstorm / output_term_name_term_id_term_title
Created May 23, 2018 06:38
output the currently viewed page term name
<?php $pxs_term_id = get_queried_object()->term_id; ?>
<?php $term = get_term($pxs_term_id); ?>
<h3><?php echo $term->name;?></h3>
@pixelstorm
pixelstorm / install wp with cli
Created May 12, 2018 10:27
install wp with cli starter script
wp core download
wp core config --dbname= --dbuser= --dbpass= --dbprefix=
wp core install --url= --title= --admin_user= --admin_password= --admin_email=
@pixelstorm
pixelstorm / sample_html_content.html
Last active May 11, 2018 12:09
sample html content lorum ipsum with h1 h2 list
Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sodales est sit amet sem varius dapibus. In quis ipsum vestibulum, euismod massa ut, tempor quam. Maecenas purus arcu, maximus ac accumsan eu, mattis in eros. Integer a molestie dolor. Donec at luctus lacus. Fusce vel tristique sem. Suspendisse sed dolor purus.
<h2>Nam sodales libero eget dolor euismod pharetra. Phasellus ut tellus in lorem rhoncus dapibus.</h2>
<ul>
<li>Maecenas purus arcu, maximus ac accumsan eu, mattis in eros.</li>
<li>Integer a molestie dolor. Donec at luctus lacus. Fusce vel tristique sem.</li>
<li>Suspendisse sed dolor purus. Nam sodales libero eget dolor euismod pharetra.</li>
<li>Phasellus ut tellus in lorem rhoncus dapibus. Proin a varius ante.</li>
</ul>
<h3>Proin a varius ante.</h3>
tempor quam. Maecenas purus arcu, maximus ac accumsan eu, mattis in eros. Integer a molestie dolor. Donec at luctus lacus. Fusce vel tristique sem. Suspendisse sed dolor purus.
@pixelstorm
pixelstorm / toggle text with btn click
Last active May 1, 2018 00:41
toggle text with btn click
jQuery(document).ready(function($) {
var show_more_btn = $("#clickme");
show_more_btn.click(function(event) {
event.preventDefault();
$( "#toggle_text_box" ).toggle( "slow", function() {
// Animation complete.
// change btn text
if (show_more_btn.text() == 'Show More') {
show_more_btn.text('Show Less');
} else {
@pixelstorm
pixelstorm / get list of terms for custom post type taxomomy and output as nav links
Last active April 27, 2018 06:08
get list of terms for custom post type taxomomy and output as nav links
<?php
//get list of linked terms to custom post type categories / terms
//change the first parameter of the $terms = get_terms( $term, $args ); to the taxomomy name you want to pull from
function cpt_category_nav($term) {
$args = array( 'hide_empty=0' );
$terms = get_terms( $term, $args );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
$count = count( $terms );
$i = 0;
@pixelstorm
pixelstorm / pagination for custom post type
Last active April 30, 2018 10:09
paginaiton for custom post type
//set up the loop, in this case we are looping through projects custom post type
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$project_query = new WP_Query( array(
'post_type' => 'project',
'posts_per_page' => 2,
'paged' => $paged
) );
?>