Skip to content

Instantly share code, notes, and snippets.

@wpflames
wpflames / events-query.php
Last active June 29, 2022 11:48
ACF Query Upcoming and Past Events
<?php
$date_now = date('Y-m-d H:i:s');
$time_now = strtotime($date_now);
$args = array(
'posts_per_page' => -1,
'post_type' => 'event',
'meta_query' => array(
array(
@wpflames
wpflames / app.component.ts
Created June 28, 2022 11:10
Create a new post object and display it in the top of our list in the browser
import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core';
@Component({
selector: 'posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent {
posts: any;
@wpflames
wpflames / app.component.ts
Created June 28, 2022 11:04
Create a new post object with form and display it in the console
import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core';
@Component({
selector: 'posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent {
posts: any;
@wpflames
wpflames / app.component.ts
Created June 28, 2022 10:28
Display data from server
import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core';
@Component({
selector: 'posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent {
posts: any;
@wpflames
wpflames / app.component.ts
Created June 28, 2022 10:02
Get data from server
import { HttpClient } from '@angular/common/http';
import { Component } from '@angular/core';
@Component({
selector: 'posts',
templateUrl: './posts.component.html',
styleUrls: ['./posts.component.scss']
})
export class PostsComponent {
posts: any[];
@wpflames
wpflames / app.component.html
Created June 27, 2022 18:41
Form validation - Checkbox, dropdown, radio and text field
<h2>Leave a comment</h2>
<form #f="ngForm" (ngSubmit)="submit(f)">
<div ngModelGroup="contact" #contact="ngModelGroup">
<div *ngIf="!contact.valid">...</div>
<div class="form-group">
<label for="firstName">First Name</label>
<input
required
minlength="3"
maxlength="10"
@wpflames
wpflames / app.component.ts
Created June 27, 2022 18:37
Form validation - Checkbox, dropdown, text field
import { Component } from '@angular/core';
@Component({
selector: 'course-form',
templateUrl: './course-form.component.html',
styleUrls: ['./course-form.component.scss']
})
export class CourseFormComponent {
categories = [
{ id: 1, name: 'Development'},
@wpflames
wpflames / app.component.html
Created June 27, 2022 18:37
Form validation - Checkbox, dropdown, text field
<form #f="ngForm" (ngSubmit)="submit(f)">
<div ngModelGroup="contact" #contact="ngModelGroup">
<div class="form-group">
<label for="courseName">Course Name</label>
<input
required
minlength="5"
maxlength="10"
ngModel
name="courseName"
<h2>Leave a comment</h2>
<form #f="ngForm" (ngSubmit)="submit(f)">
<div ngModelGroup="contact" #contact="ngModelGroup">
<div *ngIf="!contact.valid">...</div>
<div class="form-group">
<label for="firstName">First Name</label>
<input
required
minlength="3"
maxlength="10"
@wpflames
wpflames / app.component.html
Created June 27, 2022 15:46
Checkbox validation
<h2>Leave a comment</h2>
<form #f="ngForm" (ngSubmit)="submit(f)">
<div ngModelGroup="contact" #contact="ngModelGroup">
<div *ngIf="!contact.valid">...</div>
<div class="form-group">
<label for="firstName">First Name</label>
<input
required
minlength="3"
maxlength="10"