Skip to content

Instantly share code, notes, and snippets.

View chronosceptor's full-sized avatar
🛠️
Working

chronosceptor.com chronosceptor

🛠️
Working
View GitHub Profile
// Previous Post
get_permalink(get_adjacent_post(false,'',false));
// Next Post
get_permalink(get_adjacent_post(false,'',true));
/**
* Encrypt and decrypt
*
* @author Nazmul Ahsan <n.mukto@gmail.com>
* @link http://nazmulahsan.me/simple-two-way-function-encrypt-decrypt-string/
*
* @param string $string string to be encrypted/decrypted
* @param string $action what to do with this? e for encrypt, d for decrypt
*/
-- all
SELECT * FROM results;
-- specific columns
SELECT first_name, last_name, email FROM results;
-- alias
SELECT name AS "Product Name", description AS "Product Description" FROM products;
-- filter by condition
@chronosceptor
chronosceptor / Using MySQL command line with MAMP
Created February 27, 2019 16:28
To use the MySQL command line with MAMP or MAMP PRO, perform the following steps:
-- 1.- Start MAMP or MAMP PRO
-- 2.- Start the server
-- 3.- Open Terminal (Applications -> Utilities)
-- 4.- Type in: (one line)
/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot
-- select database
mysql> use DATABASE_NAME;
-- select sql
/* Target an element by any of its HTML attributes and values. */
div[id="container"] {
max-width: 500px;
margin: auto;
}
[class] {
border: solid 1px #ccc;
}
@chronosceptor
chronosceptor / Force SSL with .htaccess
Created February 7, 2019 23:49
Force SSL with .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@chronosceptor
chronosceptor / wp-config.php
Created December 19, 2018 22:36
Wordpress | Disable "wpautop" for Contact form 7
// You can disable "wpautop" for the plugin by placing the following constant in wp-config.php:
define( 'WPCF7_AUTOP', false );
@chronosceptor
chronosceptor / woocommerce.php
Created December 14, 2018 16:12
WooCommerce | Number of products to display on Shop Page
<?php
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $products ) {
// Return the number of products you wanna show per page.
$products = 6;
return $products;
}
@chronosceptor
chronosceptor / woocommerce.php
Created December 13, 2018 18:06
WooCommerce | Remove the title on the Shop page.php
<?php
// this one
add_filter( 'woocommerce_show_page_title', '__return_false' );
// or this one
add_filter( 'woocommerce_show_page_title' , 'woo_hide_page_title' );
function woo_hide_page_title() {
return false;
}
@chronosceptor
chronosceptor / escape-sequence.php
Created December 7, 2018 14:34
PHP | Escape Sequence
<?php
$name = 'cienciastar';
$string = "Lets display \"Hello $name!\" to the screen";
echo $string;