Skip to content

Instantly share code, notes, and snippets.

View sabbir1991's full-sized avatar
🏠
Working from home

Sabbir Ahmed sabbir1991

🏠
Working from home
View GitHub Profile
// JS File -- index.js
Vue.component( 'test-com', {
template: 'tmpl-test-com',
data: function() {
return {
localizeData: []
}
@sabbir1991
sabbir1991 / select2-vuejs-component.md
Created March 6, 2018 11:07 — forked from craigh411/select2-vuejs-component.md
Vue.js component for Select2

#Vue.js component for Select2

A select2 component for vue.js. Quickly create select2 components, load data via ajax and retrieve selected values and newly created tags.

#Usage

Download and register the component:

Vue.component(
@sabbir1991
sabbir1991 / vueMenuloaded.php
Created September 26, 2018 16:36
Menu under sub menu
<?php
add_action( 'admin_menu', 'prefix_admin_menu' );
function prefix_admin_menu() {
global $submenu;
add_menu_page( __( 'Project Manager', 'text-domain' ), __( 'Project Manager', 'text-domain' ), 'manage_options', 'awesome-pm', 'pm_dashboard_cb' );
$submenu[ 'awesome-pm' ][] = array( __( 'Project', 'text-domain' ), 'manage_options', 'admin.php?page=awesome-pm#/' );
/* Woocommerce Styles */
/*
A couple things to note...
1. This code was written very specifically for my base child theme so it might not work out of the box with every theme.
I have it here mostly to share with anyone who might be looking to do the same thing I was.
2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it
so that it enqueues after the default WooCommerce Stylesheets
@sabbir1991
sabbir1991 / Modal.vue
Created August 6, 2019 19:05
Modal Component for Vuejs 2.x
<template>
<div class="wpvue-modal-dialog">
<div class="wpvue-modal">
<div class="wpvue-modal-content" :style="{ width: width }">
<section :class="['wpvue-modal-main', { 'has-footer': footer }]">
<header class="modal-header" v-if="header">
<slot name="header">
<h1>{{ title }}</h1>
</slot>
</header>
➜ vvv-local git:(stable) vagrant reload --provision
__ __ __ __
\ V\ V\ V / v3.8.1 Path:"/Users/sabbir/vvv-local"
\_/\_/\_/ git::stable(8252690)
Platform: darwin19 shell:/bin/zsh vagrant-goodhosts shared_db_folder_disabled
Vagrant: v2.2.19, virtualbox: v6.1.32
Docs: https://varyingvagrantvagrants.org/
Contribute: https://github.com/varying-vagrant-vagrants/vvv
@sabbir1991
sabbir1991 / regext.php
Created January 5, 2023 07:05
Replace anchor tag content depending on specific attributes.
$input_lines = '<a href="index.php" target="_blank" class="link testing" >Test Link</a><a href="index.php" class="link testing" target="_blank" >Test Link</a><a href="index.php" target="_blank" class="link testing" >Test Link</a>';
$replace_text = preg_replace('/(\<a.*?target=\"_blank\".*?>)(.*?)(\<\/a\>)/', '$1$2<span>screen reader</span>$3', $input_lines);
echo $replace_text;
// Output...
<a href="index.php" target="_blank" class="link testing" >Test Link<span>screen reader</span></a>
<a href="index.php" class="link testing" target="_blank" >Test Link<span>screen reader</span></a>