Skip to content

Instantly share code, notes, and snippets.

@web2feel
web2feel / useAuth.js
Last active December 18, 2021 07:00
useAuth Hook
import React from "react";
const authContext = React.createContext();
function useAuth() {
const [authed, setAuthed] = React.useState(false);
return {
authed,
login() {
return new Promise((res) => {
setAuthed(true);
//******* Add Room Fields **********//
var count = 0;
$('.extra_room_field').click(function(e){
e.preventDefault();
$('.room_record:last').clone().insertAfter($('.room_record:last')).addClass('single remove row');
$('.room_record:last').find("input.r_name, input.r_price").remove();
$(".room_record:last").find("label[for='room_name']").after(
' <input type="text" class="form-control r_name" id="room_name" name="room_name" placeholder="Enter room name" value=""></input>'
import React, { useState } from "react";
function DebAp() {
const [inputList, setInputList] = useState([{ fName: "", ltName: "" , hobbys:[] }]);
const handleInputChange = (e, index) => {
const { name, value } = e.target;
const list = [...inputList];
switch(name) {
case 'fName':
@web2feel
web2feel / change.css
Created February 27, 2017 14:01
css edit
#header {
background: #fff;
position: relative; }
#header a#logo {
margin: 10px 0px;
display: inline-block; }
#header a.nav-trig {
color: #007AC0;
position: absolute;
right: 30px;
@web2feel
web2feel / test.php
Created January 5, 2017 06:34
selectbox setup
<select class="theater-select form-control" name="theater-select"> <!-- Making a select box populated with theater names -->
<option>Select a Theater</option>
<!-- Start the ACF plugin loop to fetch the showtimes metadata -->
<?php if( have_rows('showtime_info') ):
while( have_rows('showtime_info') ): the_row(); ?>
<?php $theater = get_sub_field('theater_name'); ?> <!--Returns theater taxonomy ID -->
<?php $theater_name = get_term( $theater, 'theater' ); //Returns an array of taxonomy term
$theater_nicename = $theater_name->name; //Get theater name from the array
jQuery('#kommunity').tinyNav({
active: 'current-menu-item'
});
@web2feel
web2feel / homepage.php
Created January 4, 2016 06:08
fyre portfolio
$args = array(
'posts_per_page' => $count, // Limit to posts
'post_type' => 'portfolio', // Query for the default Post type
'tax_query' => array(
array(
'taxonomy' => 'genre',
'field' => 'slug',
'terms' => 'your term name'
)
)
@web2feel
web2feel / gist:ae5444f5adf6380d554d
Created December 16, 2015 06:41
get carousel template
<?php get_template_part( 'inc/carousel' ); ?>
@web2feel
web2feel / carousel.php
Created December 16, 2015 06:29
carousel structure
@web2feel
web2feel / custom.php
Last active December 16, 2015 05:21
Customizer for slider
// Custom control for carousel category
if (class_exists('WP_Customize_Control')) {
class WP_Customize_Category_Control extends WP_Customize_Control {
public function render_content() {
$dropdown = wp_dropdown_categories(
array(