
Table of Contents
import { Controller } from "@hotwired/stimulus" | |
import { Modal } from "bootstrap" | |
// Connects to data-controller="remote-modal-events" | |
export default class extends Controller { | |
connect() { | |
let thisController = this | |
// The listener for the Bootstrap event | |
this.element.addEventListener('hide.bs.modal', function (event) { |
<?php | |
public function findByRole(Role $role): mixed | |
{ | |
$rsm = $this->createResultSetMappingBuilder('u'); | |
$query = <<<SQL | |
SELECT %s | |
FROM user u | |
WHERE u.roles::jsonb ?? :role |
<?php | |
/** | |
* Settings class | |
*/ | |
/** | |
* Class Settings | |
*/ | |
class Settings { | |
/** |
# see https://sql.sh/988-requetes-migrer-wordpress | |
# Change the URL of the site | |
UPDATE wp_options | |
SET option_value = replace(option_value, 'http://localhost:8888/site', 'http://www.site.fr') | |
WHERE option_name = 'home' | |
OR option_name = 'siteurl'; | |
# Change GUID URL | |
UPDATE wp_posts |
import { Controller } from "stimulus" | |
export default class extends Controller { | |
connect() { | |
const templates = this.element.import.querySelectorAll("template"); | |
templates.forEach(function(template) { | |
document.querySelector('body').appendChild(template); | |
}); | |
} | |
} |
<?php | |
************ Debug, Debuging ************ | |
//Activate log files in wp-config.php | |
define( 'WP_DEBUG', true ); // Enabling WP_DEBUG will cause all PHP errors, notices and warnings to be displayed. | |
define( 'WP_DEBUG_LOG', true ); // Enable Debug logging to the /wp-content/debug.log file | |
define( 'WP_DEBUG_DISPLAY', true ); // Controls whether debug messages are shown inside the HTML of pages or not. | |
// use this | |
define( 'WP_DEBUG', true ); | |
define( 'WP_DEBUG_LOG', true ); |
<notification> | |
<div id="snackbar"></div> | |
<script> | |
/* USAGE: | |
create an observable: | |
var globalEvents = riot.observable(); | |
And pull the trigger anywhere you need to: | |
globalEvents.trigger('notif_trigger', "Action done successfully"); | |
*/ | |
globalEvents.on('notif_trigger', function(data){ |
// Originally, I was using Redux to contain the state, but switched to RiotControl | |
// because of its simplicity, and how it makes use of Riot's observable API. | |
// An issue I found with RiotControl was that, when you register multiple | |
// stores, it will call 1 event 1 time per store. So if you have 6 stores, | |
// `RiotControl.trigger('my-event')` will run 6 times. This is incredibly | |
// inefficient, especially if your app is doing a lot at once. | |
// After careful consideration, I failed to see the benefit of using | |
// RiotControl and instead opted for using the native Riot observable API. |
<div id="myCarousel" class="carousel slide" data-ride="carousel"> | |
<!-- Indicators --> | |
<ol class="carousel-indicators"> | |
<li data-target="#myCarousel" data-slide-to="0" class="active"></li> | |
<li data-target="#myCarousel" data-slide-to="1"></li> | |
<li data-target="#myCarousel" data-slide-to="2"></li> | |
</ol> | |
<div class="carousel-inner" role="listbox"> | |
<?php query_posts( 'meta_key=slide&showposts=3' ); ?> | |
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> |