Skip to content

Instantly share code, notes, and snippets.

View johnmccole's full-sized avatar
💭
I may be slow to respond.

John McCole johnmccole

💭
I may be slow to respond.
  • Glasgow, Scotland
View GitHub Profile
@if(!is_front_page())
@php
$term = get_queried_object();
if(is_tax()) {
$header = get_field('image', $term->taxonomy . '_' . $term->term_id);
}
@endphp
<div class="page-header alignfull d-flex pb-5 align-items-stretch vh-100 parallax-background" style="background: rgb(50, 50, 50) url(@if(is_tax()) {!! $header['url'] !!} @else {!! the_post_thumbnail_url() !!} @endif) no-repeat center / cover; margin: 0 -15px;">
<select onchange="gotopage(this)">
<option value="">Select</option>
<option value="https://www.google.com">Google</option>
<option value="https://www.yahoo.com">Yahoo</option>
<option value="https://www.msn.com">MSN</option>
</select>
<script type="text/javascript">
function gotopage(selval){
var value = selval.options[selval.selectedIndex].value;
@php $i = 0; @endphp
@while (have_posts()) @php the_post() @endphp
@if($i==0)
@include('partials.content-first-post')
@else
@include('partials.content-'.get_post_type())
@endif
@php $i++; @endphp
@endwhile
// User clicks to play
<video playsinline controls preload disablePictureInPicture poster="" controlslist="nodownload" style="cursor: pointer;">
<source src=" type="video/mp4">
</video>
// Autoplay
<video id="backgroundVideo" class="parallax-video" autoplay="autoplay" playsinline muted loop preload disablePictureInPicture controlslist="nodownload">
<source src="" type="video/mp4">
</video>
<script>
/**
* Add custom image sizes
*/
add_image_size('960x1080', 960, 1080, true); // 960x1080, hard crop
add_image_size('1920x540', 1920, 540, true); // 1920, hard crop
add_image_size('1920x1080', 1920, 1080); // 1920x1080, proportional crop
@johnmccole
johnmccole / setup.php
Last active June 15, 2023 15:53
Get the 'resources' directory in Sage 9.
<?php get_theme_file_uri().'/resources/
// View Order Thank You page.
add_filter( 'woocommerce_order_actions', 'show_thank_you_page_order_admin_actions', 9999, 2 );
function show_thank_you_page_order_admin_actions( $actions, $order ) {
$actions['view_thankyou'] = 'Display thank you page';
return $actions;
}
add_action( 'woocommerce_order_action_view_thankyou', 'redirect_thank_you_page_order_admin_actions' );
@johnmccole
johnmccole / index.php
Created March 23, 2023 17:08
<?php echo get_stylesheet_directory_uri(); ?>
<img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/payment-types.png" alt="Payment Types" class="img-fluid payment-types">
@johnmccole
johnmccole / firing.cs
Last active March 17, 2023 04:51
Use a variable to allow the player to perform an action if the button is held. Place the variable in a Coroutine to allow the user to repeat it over. isFiring in this case, it stops the Coroutine when set to false.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Firing : MonoBehaviour
{
[Header("Weapons")]
public GameObject mainWeapon;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Firing : MonoBehaviour
{
[Header("Weapons")]
[Header("Main Weapon")]