Skip to content

Instantly share code, notes, and snippets.

View sophiawzey's full-sized avatar

Sophia Zey sophiawzey

View GitHub Profile
@sophiawzey
sophiawzey / count.php
Last active June 2, 2020 18:42
[ACF PHP] using brackets #acf
<?php $count = count( get_field( 'field-name' ) ); ?> // can be used for counting rows in a repeater. works well w/ slick slider if you only want a slider on > 2 counts
@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 / 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 / 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 / styles.scss
Last active June 27, 2019 20:48
[General SCSS] styling I always use in jointswp #foundation #scss
html {
scroll-behavior: smooth;
}
section {
padding: 3rem 0;
}
.grid-container {
width: 100%;
@media (min-width: 1500px) {
@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 / addons.php
Last active December 31, 2018 17:00
[Related Children] get the related children and exclude current post #wordpress
// count for wpquery, goes here
$the_query = new WP_Query( $args );
$count = $the_query->found_posts;
// then inside of the content
if ( $count > 2 ) {
echo '<div id="np-slider-three" class="np-slider">';
} else {
echo '<div class="grid-x grid-margin-x medium-up-3">';
};
@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;
}