Skip to content

Instantly share code, notes, and snippets.

View shishirraven's full-sized avatar
🖥️
Coding

Shishir Raven shishirraven

🖥️
Coding
View GitHub Profile
@shishirraven
shishirraven / gist:9d13bf1c7ab84e67fe708fa8c2220dcc
Created September 24, 2024 05:07
Why are we running a loop of CPT twice
add_action('rest_api_init', function () {
// Path to the config file
$config_path = plugin_dir_path(__FILE__) . '../admin_pages/site.json';
$config = json_decode(file_get_contents($config_path), true);
$post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
$order_fields = array();
<!-- wp:group {"align":"full","style":{"color":{"gradient":"linear-gradient(135deg,rgb(90,0,175) 0%,rgb(182,99,99) 100%)"},"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30","left":"var:preset|spacing|20","right":"var:preset|spacing|20"},"margin":{"top":"0","bottom":"0"}},"elements":{"link":{"color":{"text":"var:preset|color|base-2"}}}},"textColor":"base-2","layout":{"type":"constrained","contentSize":"1000px"}} -->
<div class="wp-block-group alignfull has-base-2-color has-text-color has-background has-link-color" style="background:linear-gradient(135deg,rgb(90,0,175) 0%,rgb(182,99,99) 100%);margin-top:0;margin-bottom:0;padding-top:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--20);padding-bottom:var(--wp--preset--spacing--30);padding-left:var(--wp--preset--spacing--20)"><!-- wp:columns {"verticalAlignment":"center","isStackedOnMobile":false} -->
<div class="wp-block-columns are-vertically-aligned-center is-not-stacked-on-mobile"><!-- wp:column {"vert
@shishirraven
shishirraven / main.yml
Created May 7, 2024 10:32
How to create a FTP Deployment action.
on: push
name: 🚀 Deploy website on push
jobs:
web-deploy:
name: 🎉 Deploy
runs-on: ubuntu-latest
steps:
- name: 🚚 Get latest code
uses: actions/checkout@v2
function highlightElements() {
const pageWidth = document.body.clientWidth;
const styleTag = document.createElement('style');
styleTag.innerHTML = `
.highlight {
border: 2px solid red;
background-color: yellow;
}
`;
document.head.appendChild(styleTag);
"supports": {
"__experimentalOnEnter": true,
"__experimentalSettings": true,
"align": ["wide", "full"],
"anchor": true,
"ariaLabel": true,
"html": false,
"color": {
"gradients": true,
"link": true,
@shishirraven
shishirraven / adding field
Last active October 14, 2022 14:57
Adding a Phone number to the wordPress users.
lwp_register_rest_route
add_action('edit_user_profile_update', array(&$this, 'lwp_update_phonenumber_field'));
add_action('personal_options_update', array(&$this, 'lwp_update_phonenumber_field'));
add_action('edit_user_profile', array(&$this, 'lwp_add_phonenumber_field'));
add_action('show_user_profile', array(&$this, 'lwp_add_phonenumber_field'));
function lwp_add_phonenumber_field($user)
{
<script>
import "@/../node_modules/bravevue/dist/style.css";
import slide1 from '@/components/slides/slide1.vue'
import slide2 from '@/components/slides/slide2.vue'
import slide3 from '@/components/slides/slide3.vue'
import {BraveSlider} from 'bravevue'
export default{
components:
{
BraveSlider,
@shishirraven
shishirraven / BraveTabs.vue
Created July 5, 2022 17:48
Brave Tabs Example File
<template>
<BraveTabs ref="bravetabref"
class="text-black dark:text-white p-10"
tabs-content-class="border p-10 dark:bg-slate-800"
tab-button-class="px-3 py-2 cursor-pointer rounded-t-lg mr-0 dark:bg-slate-900 bg-gray-50 hover:dark:bg-slate-800 hover:bg-gray-200"
tab-button-active-class="px-3 py-2 shadow-inner-sm -mb-px border rounded-t-lg border-b-0 dark:bg-slate-800 bg-white "
v-bind:tabs="['upload','filemanager']"
initialTab="upload">
<!-- ================================================================ -->
<!-- UPLOAD PANEL -->
@shishirraven
shishirraven / BraveSelect.vue
Last active July 5, 2022 17:57
BraveSelect Example File
<template>
<BraveSelect
class="relative inline-block"
v-model="selectValue"
:options="options"
dropdown-class="shadow rounded border absolute z-10 dark:bg-slate-900 bg-white right-0 left-0"
>
<template v-slot:button="{ selectedValue }">
<div
role="button"
@shishirraven
shishirraven / BraveGistEmbed.vue
Created June 20, 2022 19:31
Brave Gist Embed Example
<template>
<main class="flex-1 lg:p-16">
<div class="py-6">
<div class="max-w-7xl mx-auto px-4 sm:px-6 md:px-8">
<h1 class="text-4xl font-semibold mb-10">
<i class="bi me-2 bi-github"></i>
Brave Gist Embed
</h1>
<p>
You can use this Component to embed Github Gist, right now it solves