Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Add minified and RTL Stlysheets with automatic theme version
* Load styles for specific stylesheets
*/
function theme_name_css() {
$template_directory_uri = get_template_directory_uri();
$rtl = ( is_rtl() ) ? '-rtl' : '';
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
@grappler
grappler / rtl-tester.php
Created July 11, 2014 12:07
Fix for https://github.com/yoavf/RTL-Tester/issues/2 Added ``` else { $wp_styles->text_direction = $direction; }``` to line 88
<?php
/**
* RTL-Tester plugin.
*
* Adds a button to the admin bar that allow super admins to switch the text direction of the site.
*
* @package RTL_Tester
* @author Automattic
* @author Yoav Farhi
* @version 1.0.4
/*! Responsive JS Library v1.2.2 */
;
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
;
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
;window.matchMedia=window.matchMedia||(function(doc,undefined){var bool,docElem=doc.documentElement,refNode=docElem.firstElementChild||docElem.firstChild,fakeBody=doc.createElement("body"),div=doc.createElement("div");div.id="mq-test-1";div.style.cssText="position:absolute;top:-100em";fakeBody.style.background="none";fakeBody.appendChild(div);return function(q){div.innerHTML='&shy;<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';docElem.insertBefore(fakeBody,refNode);bool=div.offsetWidth==42;docElem.removeChild(fakeBody);return{matches:bool,media:q}}})(document);
/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
(function(win){
<div style="width: 100%; margin: 0px; padding: 0px; text-align: right; background-color:#FFFFFF;">
<img src="http://fahrplan.sbb.ch/img/igm-sbblogo.gif" width="110" height="18" alt="SBB|CFF|FFS" />
<h1 style="width: 100%; background-color: #DDDDDD; color: #000000; font-family: Arial, Helvetica, sans-serif; font-size:12px; font-weight: bold; padding: 2px 0px; margin: 0; height: 15px; text-align: left;clear:both;"> Timetable</h1>
<div style="width: 100%; background-color: #F8F8F8; margin: 0; padding: 0px;" summary="Layout">
<form action="http://fahrplan.sbb.ch/bin/query.exe/en?externalCall=yes&DCSext.wt_fp_request=partner_mini" name="formular" method="post" style="display:inline" target="_blank">
<input type="hidden" name="queryPageDisplayed" value="yes">
<table cellspacing="0" cellpadding="4" style="width: 100%; margin: 2px;" class="ig">
<tr>
@grappler
grappler / Gruntfile.js
Last active October 5, 2020 03:47
https://webtranslateit.com/en/docs/web_translate_it_client/ / http://docs.transifex.com/developer/client/ Run this command in the folder to install all of the files needed. `npm install --save-dev`
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
makepot: {
target: {
<?php
function wptavern_enqueue_styles() {
wp_enqueue_style('wptavern-google-fonts', '//fonts.googleapis.com/css?family=Copse');
}
add_action( 'wp_enqueue_scripts', 'wptavern_enqueue_styles' );
<?php
// Original hardcoded text
echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and watch the video.';
// Option 1
printf(
__( 'Click <a href="%s">Here</a> to go and watch the video.', 'text-domain' ),
esc_url( get_permalink() )
);
function persia_functions_js(){
wp_enqueue_style('font-awesome', get_template_directory_uri().'/fonts/font-awesome/css/font-awesome.css');
wp_enqueue_style('persia-style', get_stylesheet_uri(), array(), '20140322' );
if ( is_rtl() ) {
wp_enqueue_style( 'ResponsiveMultiLevelMenucss', get_template_directory_uri() .'/js/ResponsiveMultiLevelMenu/css/component-rtl.css');
} else {
wp_enqueue_style( 'ResponsiveMultiLevelMenucss', get_template_directory_uri() .'/js/ResponsiveMultiLevelMenu/css/component.css');
}
<?php
/**
* Plugin Name.
*
* @package Plugin_Name
* @author Your Name <email@example.com>
* @license GPL-2.0+
* @link http://example.com
* @copyright 2014 Your Name or Company Name
*/
<?php
public function enqueue_scripts() {
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script( $this->plugin_slug . '-plugin-script', plugins_url( 'assets/js/public' . $suffix . '.js', __FILE__ ), array( 'jquery' ), self::VERSION );
}