Skip to content

Instantly share code, notes, and snippets.

$floor_units = $property->floor_units;
if ( isset($floor_units->floor_unit) )
{
echo '<h4>Available Area</h4>'; // WILL BECOME DESCRIPTION TITLE
$total_size = 0;
// INSTEAD OF ECHO'ING SHOULD BE STORED AS DESCRIPTION TEXT/CONTENT
// Import AI field into custom field added using our free Template Assistant add on
add_action( "propertyhive_property_imported_agentsinsight_xml", 'import_custom_field', 10, 2 );
function import_custom_field($post_id, $property)
{
update_post_meta( $post_id, '_url', (string)$property->url );
}
// Customise the fields used in the AI import
add_action( "propertyhive_property_imported_agentsinsight_xml", 'customise_description_fields', 10, 2 );
function customise_description_fields( $post_id, $property )
add_filter( 'propertyhive_map_infowindow_html', 'change_map_link_target' );
function change_map_link_target( $html )
{
$html = "<div class=\"property\"><div class=\"image\"><a href=\"' + property.link + '\" target=\"_parent\"><img src=\"' + property.image + '\" alt=\"' + property.address + '\"></a></div><div class=\"details\"><div class=\"address\"><a href=\"' + property.link + '\" target=\"_parent\">' + property.address + '</a></div><div class=\"price\">' + property.price + ' <span class=\"price-qualifier\">' + property.price_qualifier + '</span></div><div class=\"summary\">' + summary_html + '</div></div><div style=\"clear:both\"></div></div>";
return $html;
}
add_action( 'propertyhive_property_map_marker_options', 'add_marker_icon' );
function add_marker_icon()
{
?>
marker_options.icon = 'URL HERE';
<?php
}
@mithicher
mithicher / tom-select.blade.php
Last active April 25, 2024 16:10
Tom Select Livewire Blade Component
/* Component Usage
// Data for options
$users = \App\User::limit(6)->get()->transform(fn($user) => [
'id' => $user->id,
'title' => $user->name,
'subtitle' => $user->email
]);
// Usage in view
@benogle
benogle / api-throttling-429-error-handling.js
Created March 29, 2021 22:36
An example script consuming an API with various throttling and 429 "too many requests" error handling strategies.
// An example script consuming an API with various throttling and 429 error
// handling strategies.
//
// Blog post with more context
// https://www.useanvil.com/blog/2021-03-29-throttling-and-consuming-apis-with-429-rate-limits
//
// License: MIT
import fetch from 'node-fetch'
import mapLimit from 'async/mapLimit'
@mccarlosen
mccarlosen / PDFViewer.php
Created March 7, 2021 20:14
PDFViewer Livewire Component
<?php
namespace App\Http\Livewire\Components;
use Livewire\Component;
class PdfViewer extends Component
{
public $openModal = false;
public $titleModal = "PDF Viewer";
@georgestephanis
georgestephanis / client.js
Last active June 2, 2024 23:54
This is an example client app to integrate with the WordPress 5.6 Application Passwords system. It walks the user through authenticating, and then queries and enumerates all users on the site.
(function($){
const $root = $( '#root' );
const $stage1 = $( '.stage-1', $root );
const $stage2 = $( '.stage-2', $root );
// If there's no GET string, then no credentials have been passed back. Let's get them.
if ( ! window.location.href.includes('?') ) {
// Stage 1: Get the WordPress Site URL, Validate the REST API, and Send to the Authentication Flow
const $urlInput = $( 'input[type=url]', $stage1 );
@localdisk
localdisk / Tagify.php
Last active October 17, 2022 17:04
Livewire Tagify Component
<?php
namespace App\Http\Livewire;
use App\Models\Tag;
use Illuminate\View\View;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\Container\BindingResolutionException;
use Livewire\Component;
@vejnoe
vejnoe / webflow-breakpoints.css
Last active June 21, 2023 10:58
Webflow Standard Breakpoints
@media screen and (max-width: 991px) {
/* Your responsive CSS */
}
@media screen and (max-width: 767px) {
/* Your responsive CSS */
}
@media screen and (max-width: 479px) {
/* Your responsive CSS */
}