Skip to content

Instantly share code, notes, and snippets.

@anwas
anwas / wordpress-theme-options.php
Last active June 22, 2018 13:56
[ACF WordPress temų nustatymo puslapis – Option Page] #wordpress #acf #php #options #theme
<?php
function anwp_acf_init() {
if ( function_exists( 'acf_add_options_page' ) ) {
// parent page
$parent = acf_add_options_page( array(
'page_title' => __( 'Site General Settings', 'anwp' ),
'menu_title' => __( 'Site Settings', 'anwp' ),
'menu_slug' => 'site-general-settings',
'capability' => 'edit_posts',
'parent_slug' => '',
@anwas
anwas / date-time-class-and-functions.php
Last active June 14, 2022 16:18
[Date Time class and functions] #php #date #time #datetime #function #class
<?php
// Patern http://userguide.icu-project.org/formatparse/datetime
// Patern http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
$fmt = new IntlDateFormatter('lt_LT', IntlDateFormatter::FULL,
IntlDateFormatter::NONE, 'Europe/Vilnius', IntlDateFormatter::GREGORIAN, "cccc");
$timestamp = strtotime('now');
$timestamp = strtotime('today');
$timestamp = strtotime('+7 days');
$timestamp = strtotime('next day');
echo datefmt_format( $fmt , time() );
@anwas
anwas / html-template.html
Last active September 18, 2019 23:51
[HTML page TEMPLATE] #html #template #opengraph
<!doctype html>
<html lang="lt">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<title>Page Title less than 55 characters</title>
<meta name="description" content="Description of the page less than 150 characters">
<!-- Standard favicon -->
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<!-- Recommended favicon format -->
@anwas
anwas / fonts.txt
Last active November 16, 2019 22:35
[Visos abėcėlės raidės] #fonts #abc #raides #fonts
Įlinkdama fechtuotojo špaga, sublykčiojusi pragręžė apvalų arbūzą.
@anwas
anwas / break-long-words.css
Last active May 10, 2018 07:56
[Break long words] #css #html
/* https://css-tricks.com/where-lines-break-is-complicated-heres-all-the-related-css-and-html/ */
body {
word-wrap: break-word;
overflow-wrap: break-word;
-webkit-hyphens: auto;
-epub-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
@anwas
anwas / functions.php
Last active November 16, 2019 21:46
[Pass variable to template file] #wordpress #dev #php #functions
<?php
// https://developer.wordpress.org/reference/functions/set_query_var/
// When calling a template with get_template_part()
set_query_var('my_form_id', 23);
get_template_part('my-form-template');
// arba
load_template('my-form-template'); // https://developer.wordpress.org/reference/functions/load_template/
@anwas
anwas / multiple-php.txt
Last active December 14, 2023 11:03
[Multiple PHP versions on Ubuntu] #php #dev #ispconfig
## Add repository
### https://launchpad.net/%7Eondrej/+archive/ubuntu/php
### https://launchpad.net/~ondrej/+archive/ubuntu/apache2
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt-get update
sudo apt-get dist-upgrade
@anwas
anwas / aria-tags.txt
Created June 6, 2018 07:56
[ARIA tags] #aria #accessibility
## https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA
aria-hidden="true"
@anwas
anwas / change-ubuntu-password.txt
Created July 30, 2018 05:34
[Change Ubuntu password in recovery mode] #ubuntu #password #recovery
From the boot menu, select recovery mode, which is usually the second boot option.
The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.
In recent versions of Ubuntu, the filesystem is mounted as read-only, so you need to enter the follow command to get it to remount as read-write, which will allow you to make changes:
mount -o rw,remount
If you have forgotten your username as well, type
ls /home
@anwas
anwas / ubuntu-snap-commands.txt
Last active January 17, 2021 17:38
[Ubuntu SNAP commands] #ubuntu #cli #apps #snap
## https://utappia.org/2016/04/22/how-to-search-install-remove-snap-packages-in-ubuntu/
## https://docs.snapcraft.io/core/usage
## https://www.youtube.com/watch?v=5F-1cuBfSm0
sudo snap find : To list the available packages
sudo snap install <package name>: To install a package
sudo snap list: To view all the installed snap packages
sudo snap changes: To view a list of logged actions
sudo snap refresh <package name>: To upgrade a package to its latest available version