Skip to content

Instantly share code, notes, and snippets.

@Sstobo
Sstobo / resume.txt
Last active December 20, 2017 15:26
[interview resume] #resume
# ATS system - which one, how it works
tailor keywords to match site
# apply to linked in
# use PDFs
# streamline, simplify
# important to have no resume
volunteer exp
interests
@Sstobo
Sstobo / gist:88df064b07efa72ab91fd250258ced6b
Created November 16, 2017 21:23
[plugins in WP] #php #wp #plugin
/* ################# header
* Plugin Name: My Plugin Name
* Description: A description of my plugin...
* Version: 1.0.0
* Author: Your Name
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
if ( ! defined( 'WPINC' ) ) {
die; // so the plugin file can't be accessed directly in browser
@Sstobo
Sstobo / gist:603b4e7fd6915ac30a7ccf4326796f52
Created November 16, 2017 17:48
[Classes in PHP] #php #class
class Dog {
public $name;
public $breed; #######properties
public $colour;
public function bark() {
return 'Woof!';
}
public function walk() {
return 'Happy dog :)';
}
@Sstobo
Sstobo / gist:348833be813ff6cba03fb694d89a1847
Created November 16, 2017 17:13
[Jquery in WP] #jq #js #wp
js
wrap jquery inside functions
//
$jquery needs to be inside //
(blur / focus)
@Sstobo
Sstobo / gist:1b01e7e7d32e59261b8ab9e5c9ef4fe8
Last active November 17, 2017 14:24
[Archive page and JS] #wp
appearance ###########Adding a new archive page (products)
menus
products (screen options)
view all
archives
add
rename - shop
url - product
(create archive-product.php)
get $terms - taxonomy - product-type
@Sstobo
Sstobo / gist:30d851723be80b95ca4bc0835b6079da
Created November 15, 2017 19:21
[Image path in WP] #wp #images
<img src= "<?php echo get_template_directory_url() . '/images/inhab-logo.svg' ?>"
@Sstobo
Sstobo / WP Custom post loops.txt
Created November 15, 2017 19:20
[WP Custom post loops] #wp #php #posts #post-loops
Use WP_Query when you need to create a paginated query
Use get_posts() to create static, additional loops (e.g. a list of a few recent posts on a homepage, etc.)
############## DEFAULT LOOP
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2> ###### POST TITLE
<?php the_content(); ?> ###### POST CONTENT
<?php endwhile; ?>
@Sstobo
Sstobo / gist:b69f56d00b6235e5f8b96fc9fc8ff2cb
Last active November 17, 2017 14:27
[extras.php dynamic css generation] #php #fp
function inhab_dynamic_css() {
if ( ! is_page_template( 'about.php')) {
return;
}
$image = CFS()->get('about_header_image') ;
if (! $image) {
return;
Create page from page.php
Create page in pages
Label Template in PHP file (comments in top)
Create fields, choose page template (links to page.php template label)
Go to page, select template file, get the field
@Sstobo
Sstobo / gist:e62cd495d72a9191097bfb5aac1b05d0
Created November 14, 2017 21:24
[Template Name in WP] #wp #templates
VERY IMPORTANT
<?php
/**
* Template Name: About Page
*
* @package RED_Starter_Theme
*/