Skip to content

Instantly share code, notes, and snippets.

View jessedmatlock's full-sized avatar
🏠
Working from home

Jesse Matlock jessedmatlock

🏠
Working from home
View GitHub Profile
@jessedmatlock
jessedmatlock / gist:dc40fe997b007a0d04ac7acb8ed16fc1
Created April 13, 2021 21:09
WP Gravity Forms Scroll to Error
/**
* Jump to the first error after submission
*
* @param $form
* @return mixed
*/
function gf_scroll_to_first_error_focus( $form ) {
?>
<script type="text/javascript">
if( window['jQuery'] ) {
@jessedmatlock
jessedmatlock / WP HTML Sitemap code
Created April 13, 2021 15:26
Sitemap code for word press
<?php
/**
* Template Name: Sitemap
*/
get_header(); ?>
<?php if ($GLOBALS['$show_titles']){ echo '- Sitemap'; } ?>
<section id="primary" class="content-area col-sm-12 col-md-12 col-lg-8">
<div class="content-module">
<div class="content-item">
@jessedmatlock
jessedmatlock / wp-child-page-template.php
Created March 26, 2021 13:42 — forked from kisabelle/wp-child-page-template.php
Wordpress Child Page Template
There is no specific template for child pages, but you can do this pretty easily with the get_template_part() function.
First create a file called "content-child.php".
Second create a file called "content.php".
Next, inside of page.php, place this:
<?php
if( $post->post_parent !== 0 ) {
@jessedmatlock
jessedmatlock / acf.php
Created March 26, 2021 13:42 — forked from kisabelle/acf.php
Advanced Custom Fields
/*----------------------------------------------*/
/* Image Field
/*----------------------------------------------*/
/* Return value: Attachment ID */
<?php if(get_field('logo')): ?>
<?php
$attachment_id = get_field('logo');
$size = "vendor-logo"; // (thumbnail, medium, large, full or custom size)
@jessedmatlock
jessedmatlock / acf-pagination.php
Created March 26, 2021 13:07 — forked from icetee/acf-pagination.php
ACF Repeater Field Pagination
<?php
/*
* Paginate Advanced Custom Field repeater
*/
if( get_query_var('page') ) {
$page = get_query_var( 'page' );
} else {
$page = 1;
}
@jessedmatlock
jessedmatlock / Gravity Forms + Bootstrap 4
Created March 22, 2021 17:46 — forked from brianpurkiss/Gravity Forms + Bootstrap 4
Helpful function for adding Bootstrap 4 classes to Gravity Forms fields.
<?php
/**
* Gravity Forms Bootstrap Styles
*
* Applies bootstrap classes to various common field types.
* Requires Bootstrap to be in use by the theme.
*
* Using this function allows use of Gravity Forms default CSS
* in conjuction with Bootstrap (benefit for fields types such as Address).
*
@jessedmatlock
jessedmatlock / breadcrumbs-functions.php
Created March 19, 2021 17:24 — forked from tinotriste/breadcrumbs-functions.php
Wordpress: Breadcrumbs function
<?php
/*=============================================
= BREADCRUMBS =
=============================================*/
// to include in functions.php
function the_breadcrumb() {
$sep = ' > ';
@jessedmatlock
jessedmatlock / wp_breadcrumbs.php
Created March 19, 2021 17:24 — forked from alex-wdmg/wp_breadcrumbs.php
A custom WordPress nav walker class to implement the Bootstrap 4 breadcrumbs style in a custom theme using the WordPress.
<?php
/**
* WP Bootstrap Breadcrumbs
*
* @package WP-Bootstrap-Breadcrumbs
*
* Description: A custom WordPress nav walker class to implement the Bootstrap 4 breadcrumbs style in a custom theme using the WordPress.
* Author: Dimox - @Dimox, Alexsander Vyshnyvetskyy - @alex-wdmg
* Version: 1.1.0
* Author URI: https://github.com/Dimox
/*
* Filter the output of Yoast breadcrumbs so each item is an <li> with schema markup
* @param $link_output
* @param $link
* @return string
*/
function revive_update_yoast_breacrumbs( $link_output, $link ) {
$updated_output = '<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">';
$updated_output .= '<a itemprop="item" href="' . $link['url'] . '" itemprop="url">' . $link['text'] . '</a>';
@jessedmatlock
jessedmatlock / acf-tsf-integration.php
Created March 17, 2021 14:24 — forked from doubleedesign/acf-tsf-integration.php
Get meta descriptions in The SEO Framework from ACF flexible content fields
<?php
/**
* The SEO Framework + ACF flexible content integration
* TSF will look at the excerpt and then the content to generate the default meta description.
* If both of those are empty, this code looks for ACF flexible modules to get it from.
* // TODO: Make this work with archives as well as posts
* @param $description
* @param $args
*
* @return mixed|string