#Usefual WP Questions and Answers From Stack
- Best Collection of Code for your functions.php file - a collection of usefual functions to your functions.php file
#Usefual WP Questions and Answers From Stack
| #! /bin/bash | |
| wpCLI=`wp` | |
| if [ "$wpCLI" = "" ] | |
| then | |
| echo "WP-cli does not exist on this system." | |
| # exit 1 | |
| fi | |
| wp plugin list | tr -d '|' | grep 'active' | cut -f 1,4 | awk ' BEGIN { ORS = ""; print "plugins: {"; } { print "\/\@"$1"\/\@" " : " "\/\@"$2"\/\@"; } END { print "},"; }' | sed "s^\"^\\\\\"^g;s^\/\@\/\@^\",\"^g;s^\/\@^\"^g" > pluginss.json |
| <?php | |
| /* ====================================================== | |
| This script is NOT FULLY TESTED (not tested on Windows Server either) | |
| USE AT YOUR OWN RISK - development environment Ubuntu Linux 14.04.3 LTS | |
| The purpose of this script is for small websites and blogs | |
| to have their existing media to work through Amazon S3 | |
| There's a great plugin, WP Offload S3, that we'll be tapping | |
| into...it works great for new media, but this is a quick |
| var ss = SpreadsheetApp.getActiveSheet(); | |
| var lastRow = ss.getLastRow(); | |
| // my table col where: timestemp, amount, diff, donorsNum, donors name | |
| var MONEYCOL = 2; | |
| var DonorsCOL = 4; | |
| function parseHtml(searchString){ | |
| var url = ''; //this is the roject URL. tested on www.giveback.co.il, should probebly work on https://headstart.co.il/ with minor changes | |
| var html = UrlFetchApp.fetch(url).getContentText(); |
| (function($) { | |
| // define easeInOutQuint | |
| $.easing.jswing = $.easing.swing; | |
| $.extend($.easing, { | |
| easeInOutQuint: function(x, t, b, c, d) { | |
| if ((t /= d / 2) < 1) return (c / 2) * t * t * t * t * t + b; | |
| return (c / 2) * ((t -= 2) * t * t * t * t + 2) + b; | |
| } |
| <?php get_header(); ?> | |
| <?php | |
| global $post; | |
| $slug; | |
| if (is_front_page()) { | |
| $slug = "front"; | |
| } else if (file_exists(locate_template('partials/content-' . $post->post_name . '.php'))) { | |
| $slug = $post->post_name; | |
| } else { |
| #!/usr/bin/env bash | |
| if [ -z ${WPCONFIG+x} ]; then WPCONFIG=/Users/amit/.wpconfig; fi | |
| THEMENAME="${PWD##*/}" | |
| getDefualtValues(){ | |
| echo "getting defualt values..." | |
| if [ -f "$WPCONFIG" ]; then | |
| source "$WPCONFIG" | |
| else | |
| echo "Please create and set your WPCONFIG file on ${WPCONFIG} or change path by WPCONFIG varible" |
| // collection pre-request script | |
| // obtain parameters from collection configuration | |
| const domain = pm.environment.get("auth0_domain"); | |
| const client_id = pm.environment.get("auth0_client_id"); | |
| const audience = pm.environment.get("auth0_audience"); | |
| const client_secert = pm.environment.get("auth0_client_secret"); | |
| const username = pm.environment.get("username"); | |
| const password = pm.environment.get("password"); |
| const sse = new EventSource('/api/v1/sse'); | |
| const socket = new WebSocket('ws://localhost:8080/api/v1/socket'); |
| // addEventListener version | |
| evtSource.addEventListener("open", (e) => { | |
| console.log("The connection has been established."); | |
| }); | |
| // onopen version | |
| evtSource.onopen = (e) => { | |
| console.log("The connection has been established."); | |
| }; | |
| // Connection opened | |
| socket.addEventListener("open", (event) => { |