Skip to content

Instantly share code, notes, and snippets.

@nektobit
nektobit / index.html
Created Mar 21, 2019
spinner with changed text (pure html)
View index.html
<html>
<body style="margin: 0">
<p>Content</p>
<div style="width: 800px; height: 600px;">
<!-- just parent div -->
<div id="textspinner_wrapper">
<div id="textspinner_circle"></div>
<p id="textspinner_text"></p>
View save_wp_table_to_json
<?php
function wcpi_add_my_products_section( $sections ) {
$sections['wcpi_settings'] = 'Иконки товаров';
return $sections;
}
add_filter( 'woocommerce_get_sections_products', 'wcpi_add_my_products_section' );
// Add Settings for new section
function wcpi_add_my_products_settings( $settings, $current_section ) {
// make sure we're looking only at our section
if ( 'wcpi_settings' === $current_section ) {
@nektobit
nektobit / getmyver.php
Created Oct 8, 2018
Get version of current plugin (in frontend also works)
View getmyver.php
function get_my_version() {
if (!function_exists('get_plugin_data')) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php');
}
$pluginObject = get_plugin_data( __FILE__ );
return $pluginObject['Version'];
}
//wp_die(get_my_version());
@nektobit
nektobit / file.php
Created Sep 12, 2017
Best WP test function
View file.php
<?php
/**
* Usage:
* $something = 'string';
* $something = array('key' => 'value', $something);
* do_action('testlog', $something);
*/
add_action('testlog', 'do_testlog');
function do_testlog($arg) {
@nektobit
nektobit / wp.sh
Created Nov 17, 2015
wp install on sprinthost
View wp.sh
#!/bin/bash -e
clear
echo "============================================"
echo "WordPress Install Script"
echo "============================================"
echo "Database Name: "
read -e dbname
echo "Database User: "
read -e dbuser
echo "Database Password: "
You can’t perform that action at this time.