Skip to content

Instantly share code, notes, and snippets.

@Kiwithing
Kiwithing / MyNovaFlexibleLayout.php
Last active January 11, 2024 20:04
Laravel Nova Flexible Content Layout and Nova Select field default value.
<?php
/**
* Create a Nova select field and assign a default value in a Nova Flexible Content layout.
* Flexible Content: https://github.com/whitecube/nova-flexible-content
* Nova select field: https://nova.laravel.com/docs/resources/fields.html#select-field
*/
namespace App\Nova\Flexible\Layouts;
@Kiwithing
Kiwithing / Reload Gravity Form Link
Created October 3, 2019 19:17 — forked from rodriguesmarcos/Reload Gravity Form Link
This snippet allows the form to be reloaded by including the following link in the confirmation message: <a href="" id="reload-form">Submit this form again?</a> You can customize the text of link, but leave the "id" attribute as is.
@Kiwithing
Kiwithing / makelink.sh
Last active October 23, 2018 18:55
Auto project folder + Nginx config
@Kiwithing
Kiwithing / .htaccess
Created January 19, 2016 21:34
Block WP API access via htaccess.
# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
deny from all
</Files>
<?php
//Grab pages, print subnav if page has children.
$id = get_the_ID();
$ancestors = get_post_ancestors($id);
// Get top parent of this page or current page
$topParent = $id;
@Kiwithing
Kiwithing / mapmarkerwordpress
Last active June 9, 2016 15:07
A bit sloppy implimentation of Google Maps, MarkerClusters.js, and Wordpress location custom fields.
<?php
//Grabbing locations depending on the page
if ( is_page( 'facilities' ) ) {
$metaValue = 'facility';
} elseif ( is_page( 'dropoff' ) ) {
$metaValue = "dropoff";
} else {
$metaValue = "event";
}
<form action="<?php bloginfo('url'); ?>" method="get">
<?php
//Generate dropdown list
$select = wp_dropdown_pages(array(
'echo' => 0,
'sort_column' => 'post_title',
));
echo str_replace('<select', '<select onchange="this.form.submit()" class="whatever"', $select);
?>
</form>