Skip to content

Instantly share code, notes, and snippets.

View tjkhara's full-sized avatar

tjkhara

View GitHub Profile
@tjkhara
tjkhara / site-post-types.php
Created November 24, 2021 16:06
mu-plugins code
<?php
function site_post_types() {
// Project
register_post_type('project', array(
'show_in_rest' => true,
'supports' => array('title', 'editor', 'excerpt'),
'rewrite' => array('slug' => 'projects'),
'has_archive' => true,
'public' => true,
<?php
add_action('rest_api_init', 'getawayRegisterRoute');
function getawayRegisterRoute() {
register_rest_route( 'getaway/v1', 'data', array(
'methods' => WP_REST_SERVER::READABLE,
'callback' => 'getawayDataResults'
));
}
@tjkhara
tjkhara / chartjs.html
Created September 10, 2021 03:33
Chart.js starter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<title>Document</title>
</head>
@tjkhara
tjkhara / wp_template_tags.php
Created June 14, 2021 12:39
Wordpress template tags
<?php get_header(); ?>
<div id="content">
<!-- Static Front Page -->
<?php if( is_front_page() && !is_home() ): ?>
<h1>Static Front Page</h1>
<?php endif; ?>
@tjkhara
tjkhara / _card.scss
Created May 9, 2021 08:26
Copied from final project
.card {
// FUNCTIONALITY
perspective: 150rem;
-moz-perspective: 150rem;
position: relative;
height: 52rem;
&__side {
height: 52rem;
@tjkhara
tjkhara / _composition.scss
Created May 9, 2021 06:34
Worked on the images
.composition {
position: relative;
&__photo {
width: 55%;
box-shadow: 0 1.5rem 4rem rgba($color-black, 0.4);
border-radius: 2px;
position: absolute;
z-index: 10;
transition: all 0.2s;
@tjkhara
tjkhara / _home.scss
Created May 9, 2021 06:22
See all the media queries added here
.section-about {
background-color: $color-gray-light-1;
padding: 25rem 0;
margin-top: -20vh;
@include respond(tab-port) {
padding: 20rem 0;
}
}
@tjkhara
tjkhara / _base.scss
Created May 7, 2021 07:08
With full notes explaining the media queries management with mixins
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
// This defines what 1rem is
// Media query manager
/*
0 - 600px: Phone
600 - 900px: Tablet in portrait
900 - 1200px: Tablet in landscape
[1200 - 1800] is where our normal styles apply
1800+: Big desktop
$breakpoint argument choices:
@tjkhara
tjkhara / natours_nav_3.scss
Created May 4, 2021 07:09
End of video 49
.navigation {
&__checkbox {
display: none;
}
&__button {
background-color: $color-white;
// This is also a circle slightly bigger than the background circle
// To cover it properly
height: 7rem;