Skip to content

Instantly share code, notes, and snippets.

View neverything's full-sized avatar

Silvan Hagen neverything

View GitHub Profile
<?php
namespace App\Http\Middleware;
use App\Models\TeamInvitation;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Http\Request;
class Authenticate extends Middleware
{
<!-- Start Duda GA4 ecommerce tracking -->
<script>
window.onload = () => {
const currency = 'CHF';
const brandName = 'Nina Burri';
// Bail if we are not on a shop page.
if (typeof Ecwid == 'undefined') {
return;
@neverything
neverything / yoast-faq.css
Last active March 23, 2022 16:53 — forked from freddielore/yoast-faq.css
[Yoast SEO FAQ] Add collapsible headers support to Yoast SEO FAQ schema
/* Accordion
------------------------------------------------------------ */
.schema-faq-question{
cursor: pointer;
}
.schema-faq-question:before{
width: 16px;
height: 20px;
display: inline-block;
/**
* Video sizes per project/page id.
*
* Edit this part and only include what you need.
*/
const videoSizes = {
444 : {
tabletPortrait : 'https://path-to-video.de/video1.mp4',
mobile : 'https://path-to-video.de/video2.mp4',
},
<?php
/**
* Shortcode: [pp_tax_list] to render an unlinked list of taxonomy terms assigned
* to the current object.
*
* How to use: [pp_tax_list tax='<taxonomy>']
* Optional params are:
* display='list|string' defaults to list
* wrapper_class='pp-tax-list' any css classes that are needed on the wrapper div.
*
<?php
add_filter( 'generate_post_author_output', function( $output ) {
if ( is_singular( 'post' ) ) {
$current_id = get_the_ID();
$social_links = [];
// Add opening div
$social_links[] = '<div class="social-sharing">';
// Intro Text
$social_links[] = '<span>Artikel teilen: </span>';
<?php
/**
* Remove Do Not Track Attribute from URLs of embeds like Videos.
*
* @param string $provider oembed Provider
* @param string $url embed url
* @param array $args embed args
*
* @return string $url with custom add-ons.
*/
.logged-in .ld-progress {
display: none;
}
/* .ld-progress might hase to be changed, depending on your theme */
@neverything
neverything / rankmath-faq-accordion-all-items-closed.js
Last active August 28, 2023 08:58
RankMath SEO: FAQ block with collapsible headers aka an accordion, see full blog post: https://silvanhagen.com/writing/rankmath-faq-block-accordion/
//
// This version hides all answers by default.
//
(function ($) {
var rankMath = {
accordion: function () {
$('.rank-math-block').find('.rank-math-answer').hide(); // hides all answers by default
$('.rank-math-block').find('.rank-math-question').click(function () {
//Expand or collapse this panel
<?php
/**
* Hide CPT from Search
*/
function update_my_custom_type() {
global $wp_post_types;
if ( post_type_exists( 'wpm-testimonail' ) ) {