Skip to content

Instantly share code, notes, and snippets.

View marbaque's full-sized avatar

marbaque

View GitHub Profile
wp core download
wp core config --dbname="dbname" --dbuser="dbuser" --dbpass="dbpass" --extra-php <<PHP
/* Pressbooks */
define( 'WP_DEFAULT_THEME', 'pressbooks-book' );
define( 'PB_PRINCE_COMMAND', '/usr/bin/prince' );
define( 'PB_KINDLEGEN_COMMAND', '/opt/kindlegen/kindlegen' );
define( 'PB_EPUBCHECK_COMMAND', '/usr/bin/java -jar /opt/epubcheck-3.0.1/epubcheck-3.0.1.jar' );
define( 'PB_XMLLINT_COMMAND', '/usr/bin/xmllint' );
PHP
wp core install --url="http://domain.com" --title="Pressbooks" --admin_user="username" --admin_password="password" --admin_email="user@domain.com"
<?php
$settings=array(
/* (string) Unique identifier for the form. Defaults to 'acf-form' */
'id'=>'acf-form',
/* (int|string) The post ID to load data from and save data to. Defaults to the current post ID.
Can also be set to 'new_post' to create a new post on submit */
'post_id'=>false,
@marbaque
marbaque / list.dart
Last active March 18, 2020 14:28 — forked from angelabauer/list.dart
void main() {
List<String> myList = [
'Angela',
'James',
'Katie',
'Jack',
];
//print(myList[2]);
@marbaque
marbaque / show_and_write_thumbnail_functions.php
Created September 23, 2019 16:18 — forked from siddartha/show_and_write_thumbnail_functions.php
Function to show and/or write thumbnails generated by Mshots from WP.org
<?php
/**
* Display thumbs generate by Wordpress' service Mshot and write
* locally the thumb after generation to have better loading web performance.
*
* Thx @jd_ma for help :)
*/
function show_and_write_thumbnail ($url, $width=200, $height=150) {
@marbaque
marbaque / functions.php
Created July 11, 2019 15:14 — forked from taniarascia/functions.php
Inlcuding custom fields and uploads in a WordPress post
<?php
function create_post_your_post() {
register_post_type( 'your_post',
array(
'labels' => array(
'name' => __( 'Your Post' ),
),
'public' => true,
'hierarchical' => true,
@marbaque
marbaque / wp-snapshot-shortcode.php
Created March 21, 2019 00:27 — forked from wpscholar/wp-snapshot-shortcode.php
Shortcode displays snapshots of remote sites on your WordPress site.
<?php
/**
* This shortcode will allow you to create a snapshot of a remote website and post it
* on your WordPress site.
*
* [snapshot url="http://www.wordpress.org" alt="WordPress.org" width="400" height="300"]
*/
add_shortcode( 'snapshot', function ( $atts ) {
$atts = shortcode_atts( array(
@marbaque
marbaque / .gitignore
Created July 22, 2018 22:12 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@marbaque
marbaque / Retina Mixin
Created April 29, 2018 15:54 — forked from dallasbpeters/Retina Mixin
A Sass Mixin for retina images.
@mixin image-2x($image, $width, $height) {
@media (min--moz-device-pixel-ratio: 1.3),
(-o-min-device-pixel-ratio: 2.6/2),
(-webkit-min-device-pixel-ratio: 1.3),
(min-device-pixel-ratio: 1.3),
(min-resolution: 1.3dppx) {
/* on retina, use image that's scaled by 2 */
background-image: url($image);
background-size: $width $height;
}