Skip to content

Instantly share code, notes, and snippets.

@awakekat
awakekat / repeateracf.txt
Last active February 9, 2016 00:52
repeater date ACF
<?php
/*
Template Name: Sunday Adult
*/
get_header(); ?>
<div class="primary-content col-md-7 col-md-push-2">
<main id="main" class="main" role="main">
@awakekat
awakekat / repeater2.txt
Created February 9, 2016 01:07
ACF repeater
<?php
/*
Template Name: Sunday Adult
*/
get_header(); ?>
<div class="primary-content col-md-7 col-md-push-2">
<main id="main" class="main" role="main">
<?php echo the_content(); ?>
<?php $repeater = get_field('sunday_adult');
function sendFormByEmail(e)
{
// Remember to replace XYZ with your own email address
var email = "XYz";
// Optional but change the following variable
// to have a custom subject for Google Docs emails
var subject = "Calendar Submission Entry Email";
// The variable e holds all the form values in an array.
@awakekat
awakekat / gravityforms.txt
Created February 11, 2016 05:21
Add classes to Gravity Forms fields based on the type of field (i.e. address, name, email, etc.) In functions.php
// Add field type class to Gravity Forms fields
add_filter( 'gform_field_css_class', 'gf_field_type_classes', 10, 3 );
function gf_field_type_classes( $classes, $field, $form ) {
$classes .= ' gfield_' . $field->type;
return $classes;
}
@awakekat
awakekat / gitignore.txt
Created February 13, 2016 01:53
big gitignore
# Created by https://www.gitignore.io/api/osx,codekit,bower,sass,wordpress,yeoman
### OSX ###
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
@awakekat
awakekat / wpMenuCustom.txt
Created February 17, 2016 15:39
Strip WP tags from menu
<?php
echo strip_tags(
wp_nav_menu(
array('theme_location' => 'primary',
'container_class' => 'top-nav',//custom container class
'echo' => false,
'items_wrap' => '%3$s'
)
),
'<a><div>'
@awakekat
awakekat / RegularWPMenu.txt
Created February 17, 2016 15:41
Regular WP Menu with some parameters
<?php
$args = array(
'container' => 'ul',
'fallback_cb' => '',
'echo' => true,
'link_before' => '',
'link_after' => '',
'items_wrap' => '%3$s',
'theme_location' => 'primary',
);
@awakekat
awakekat / category.txt
Created March 25, 2016 06:19
Pull the category name in lowercase letters
<?php $category_detail=get_the_category();
foreach($category_detail as $cd){
echo $cd->slug;
} ?>
@awakekat
awakekat / Custom WP truncate words
Created March 27, 2016 22:48
Custom WP truncate words
<p><?php
$content = get_the_content();
echo wp_trim_words( $content , '45' ); ?>
<a href="<?php the_permalink(); ?>"> Read More</a></p>
@awakekat
awakekat / postscat.txt
Created March 28, 2016 17:26
WP Posts by Category
<?php
/*
Template Name: Post by Category
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
// store categories in varialble $cats
<?php $cats = get_categories();
// loop