Skip to content

Instantly share code, notes, and snippets.

View asheshmagar's full-sized avatar
😎

Ashesh Magar asheshmagar

😎
View GitHub Profile
<?php
class UR_Pro_Seed_Analytics_Data_Command extends WP_CLI_Command {
/**
* Validate all required tables exist before seeding
*
* @return bool|WP_Error
*/
private function validate_required_tables() {
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
# WordPress Coding Standards
# https://make.wordpress.org/core/handbook/coding-standards/
root = true
[*]
charset = utf-8
@asheshmagar
asheshmagar / functions.php
Last active November 20, 2023 13:44
Example of Changing Masteriyo Certificate Student Name Font Family to Lucida Handwriting.
<?php
// 1: Download the font files you want to use. You can find free fonts on websites like Google Fonts or use your custom font files.
// 2: Create a directory named 'fonts' in your child theme directory (where your style.css and functions.php files are located).
// 3: Place the downloaded font files (.ttf and .afm) in the 'fonts' directory.
// 4: Add the following script in your child theme's functions.php.
/**
* File customizer.js.
*
* Theme Customizer enhancements for a better user experience.
*
* Contains handlers to make Theme Customizer preview reload changes asynchronously.
*/
/**
*
function add_custom_script() {
?>
<script type="text/javascript">
function geoip(json){
var hireATag = document.createElement( 'a' );
hireATag.setAttribute( 'href', 'https://themegrill.com/careers/' );
hireATag.className = 'tg-hiring-link';
var hireImgTag = document.createElement( 'img' );
hireImgTag.setAttribute( 'src', 'https://themegrill.com/wp-content/uploads/2020/12/tg-hiring-tag.svg' );
if ( 'blog_masonry_content' === get_theme_mod( 'spacious_archive_display_type', 'blog_large' ) ) {
function add_read_more($more) {
global $post;
return $more . '<a href="'. get_permalink( $post->ID ). '" class="readmore">read more</a>';
}
add_filter('the_excerpt', 'add_read_more');
}
/**
* Customize comment form default fields.
*/
function colormag_comment_form_default_fields( $fields ) {
$commenter = wp_get_current_commenter();
$user = wp_get_current_user();
$user_identity = $user->exists() ? $user->display_name : '';
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$html_req = ( $req ? " required='required'" : '' );
<script>
(
function() {
var productDescription = document.querySelectorAll( 'div[itemprop="description"]' ),
oldString = 'Produktbeschreibung',
newString = '<strong style="display: inline-block;">Produktbeschreibung</strong>';
if ( ! productDescription) {
return;
}
<script type="text/javascript">
var body = document.querySelector( 'body' ),
headerBtm = document.querySelector( '.tg-site-header .tg-site-header-bottom' ),
pageWidth;
if ( body && body.classList.contains( 'tg-container--boxed' ) && body.classList.contains( 'tg-sticky-header' ) ) {
pageWidth = getComputedStyle( document.getElementById( 'page' ) ).width;
headerBtm.style.width = pageWidth;
window.addEventListener(
'resize',
add_filter( 'embed_oembed_html', 'wpse_embed_oembed_html', 99, 4 );
function wpse_embed_oembed_html( $cache, $url, $attr, $post_ID ) {
$classes = array();
// Add these classes to all embeds.
$classes_all = array(
'responsive-container',
);
// Check for different providers and add appropriate classes.