Skip to content

Instantly share code, notes, and snippets.

@DMSpeed
DMSpeed / page_faq.php
Created September 5, 2017 22:53
FAQ page built with Advanced Custom Fields (based on WPBeaches)
<?php
/*
Template Name:FAQ Page
*/
//Thanks to WPBeaches for this code: https://wpbeaches.com/creating-a-faq-page-in-wordpress-using-acf-and-jquery/
add_action( 'genesis_entry_content', 'wpb_faq_repeater_page', 10 );//Position FAQs after post content
function wpb_faq_repeater_page () {
//My ACF Fields for reference
//faqs - field group
@DMSpeed
DMSpeed / gravityform-sections.php
Last active December 28, 2015 12:36
Allows you to wrap a section of fields on a Gravity Form in a CSS class
//* Format specific sections in a Gravity Form - code based on
// http://www.jordancrown.com/multi-column-gravity-forms/ and https://sridharkatakam.com/splitting-gravity-forms-fields-into-2-columns/
function gform_format_sections( $content, $field, $value, $lead_id, $form_id ) {
if( !IS_ADMIN ) { // only perform on the front end
// target section breaks
if( $field['type'] == 'section' ) {
$form = RGFormsModel::get_form_meta( $form_id, true );
// check for the presence of formatted section class
@DMSpeed
DMSpeed / page_consolidated_links.php
Last active August 29, 2015 14:22
Gets fields from a specific list of pages and displays them in a page template for the Genesis framework
<?php
/*
This code will make members signing up for membership level #1 authors and make them subscribers when they cancel.
*/
function my_pmpro_after_change_membership_level($level_id, $user_id)
{
if($level_id == 1)
{
//New member of level #1. If they are a subscriber, make them an author.
$wp_user_object = new WP_User($user_id);
@DMSpeed
DMSpeed / page_update_profile.php
Last active August 29, 2015 14:12
Genesis page template for updating the user's profile on the front end using acf_form
<?php
/**
* Template Name: Update Profile
* This template displays a form for updating the user's profile on the front end
* Based on https://daronspence.wordpress.com/2014/09/29/front-facing-user-profile-editing-customization-with-acf/
*/
acf_form_head();
get_header();
/** Add post image above post title */
add_action( 'genesis_before_post_title', 'decor_post_image' );
function decor_post_image() {
if ( is_page() ) return;
else
if( in_array( 'teaser', get_post_class() ) && $image = genesis_get_image( 'format=url&size=grid-image' ))
{printf( '<a href="%s" rel="bookmark" class="post-photo"><span class="grid-date">%s</span><img src="%s" alt="%s" /></a>', get_permalink(), do_shortcode( '<em>[post_date format="j"]</em>[post_date format="F Y"]' ), $image, the_title_attribute( 'echo=0' ) );
<? php
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
@DMSpeed
DMSpeed / separate-excerpts.php
Created March 20, 2013 20:06
Code to modify excerpt length using Bill Erickson's grid loop
/**
* Grid Content
* Change the number of words in excerpt if in the grid loop
*/
function be_grid_content() {
// First, we make sure we're in the grid loop.
if( ! apply_filters( 'is_genesis_grid_loop', false ) )
return;
<?php
/*
* Template Name: Question
* This template displays Question Details
*/
add_action('genesis_after_post_content', 'child_get_questions_field'); //display meta-box content after the content
//Function to show the content
function child_get_questions_field() {
@DMSpeed
DMSpeed / Widgetmenu.css
Created December 8, 2012 03:27
Styling a widget menu
.widget_nav_menu ol, .widget_nav_menu ul {
margin: 2px 0 0 0px;
}
.widget_nav_menu ol ol, .widget_nav_menu ul ul {
margin: 0 0 0 0px;
}
.widget-area ul li {
list-style-type: square;
word-wrap: break-word;
}