Skip to content

Instantly share code, notes, and snippets.

View sophiawzey's full-sized avatar

Sophia Zey sophiawzey

View GitHub Profile
@sophiawzey
sophiawzey / _megamenu.scss
Last active March 20, 2020 20:23 — forked from ahaywood/header.scss
WordPress: Mega Menu
.primary-menu {
&__wrapper {
background: rgba(white, 0.3);
width: 100%;
}
}
@sophiawzey
sophiawzey / ajax.php
Created October 9, 2019 14:34
[WP AJAX] #ajax
<?php
function exampleAjaxResponse()
{
die(); // or exit; or wp_die();
}
// Note you need both of them to work for logged in & not logged in users.
add_action('wp_ajax_your_action_name', 'exampleAjaxResponse');
@sophiawzey
sophiawzey / related-blogs.php
Created September 30, 2019 02:23
[Related Blog Posts]
@sophiawzey
sophiawzey / lozad.php
Last active August 16, 2019 15:03
[lozad stuff]
<?php
$image = get_field( 'image' );
if ( ! empty( $image ) ) {
// thumbnail
$size = 'medium';
$thumb = $image['sizes'][ $size ];
} else {
$thumb = '/wp-content/themes/topfloor-parcel/assets/images/placeholder.png';
} ?>
@sophiawzey
sophiawzey / share-buttons.php
Last active February 27, 2020 18:47
[social share]
<?php
/**
* Social Share buttons
*/
$actual_link = urlencode( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
$title = get_the_title();
?>
<div class="share-buttons">
@sophiawzey
sophiawzey / breadcrumbs.php
Created January 22, 2019 21:00
[breadcrumbs] #php #wordpress #needswork
<?php
// Breadcrumbs
function custom_breadcrumbs() {
// Settings
$separator = '|';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumbs';
@sophiawzey
sophiawzey / bullets.scss
Created December 18, 2018 19:25
[Font Awesome Bullet Points] #font-awesome #scss
.content li:before {
font-family: "Font Awesome 5 Pro";
content: "\f00c";
margin: 0 7px 0 -26px;
color: #9a7ba3;
}
@sophiawzey
sophiawzey / theme-options.php
Created December 14, 2018 17:26
[ACF Theme Options] #wordpress #acf
<?php
//ACF Admin Options
if( function_exists('acf_add_options_page') ) {
acf_add_options_page([
'page_title' => 'Theme Settings',
'menu_title' => 'Theme Settings',
'menu_slug' => 'theme-settings',
'capability' => 'edit_posts',
@sophiawzey
sophiawzey / wp-config.php
Created December 12, 2018 18:18
[Getting Started: Wordpress] #wordpress
// make sure to add this line to disable the editor
define( 'DISALLOW_FILE_EDIT', true );
@sophiawzey
sophiawzey / custom-post-type.php
Created December 4, 2018 16:23
[CPT Jobs] #wordpress
// Register Custom Post Type
function careers_job_detail() {
$labels = array(
'name' => _x( 'Jobs', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Job', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Jobs', 'text_domain' ),
'name_admin_bar' => __( 'Job', 'text_domain' ),
'archives' => __( 'Job Archives', 'text_domain' ),
'attributes' => __( 'Job Attributes', 'text_domain' ),