Skip to content

Instantly share code, notes, and snippets.

@huubl
huubl / gravity-form.php
Created July 11, 2020 11:39 — forked from wkw/gravity-form.php
Custom: Gravity Forms WP API Submission and GF API form entry creation plus send notifications
<?php
/**
* Add WP API endpoint for form submission, then create new
* Gravity Forms entry and send notifications.
*/
// rest api endpoint for forms submission
add_action( 'rest_api_init', function () {
register_rest_route( 'ahr/v1', '/forms', array(
'methods' => 'POST',
@huubl
huubl / adjust_offset_pagination.php
Created March 9, 2020 15:35
Changing the posts per page on first page
add_action( 'pre_get_posts', 'query_offset', 1 );
function query_offset( &$query ) {
// Before anything else, make sure this is the right query...
if ( ! ( $query->is_home() || is_main_query() ) || is_admin() ) {
return;
}
// First, define your desired offset...
$offset = -1;