Skip to content

Instantly share code, notes, and snippets.

View oneblackcrayon's full-sized avatar

Frederick Polk oneblackcrayon

View GitHub Profile
@oneblackcrayon
oneblackcrayon / 0-Using two loops on a home.php with pagination on the second loop.md
Last active October 19, 2022 02:42
Using two loops on a home.php with pagination on the second loop.

Wordpress - Using two loops on a home.php with pagination on the second loop notes & examples

Problem

I have a layout where I need to show the most recent post in a different layout/design component and remaining posts, needed to have a separate layout/design. I also wanted to use pagination to show other posts instead of infinite scrolling because I do not prefer infinite scrolling. Using the count modulus was not going to be a viable option due to how the design needed to be implemented but I think it could work for someone with experience in PHP. When using the offset in the loop, it was changing on pagination so each page after the first page had different recent post.

This was troublesome but I think I have a solid working solution for having multiple loops it works for my needs.

@iamsaief
iamsaief / README-Fluid-Typography.md
Last active November 30, 2022 04:05
Fluid Typography Utility Classes

🎯  Fluid Typography Utility Classes SASS mixin

✨ The idea of fluid typography has been around in application development for a while, but to make this work in the browser, developers had to use a variety of solutions. 

👨‍💻 Depending on the viewport width, fluid typography adjusts nicely between the minimum and maximum value. Typically, it starts at a minimum value and stays constant until a certain screen width point, at which time it starts to rise. When it hits a maximum value at a different screen width, it keeps going with that maximum value.

👨‍🏫  For instance, if we wanted our font size to be between 2em and 3em, where 2em is the minimum size at the smallest viewport width of 320px and 3em is the maximum size at the highest viewport width of 1366px. Then our equation will look like this - font-size: calc(2em + 1 * (100vw - 320px) / 1046);

@megclaypool
megclaypool / fluid-headers.scss
Last active November 30, 2022 04:06
[Fluid Type Sass Mixin and Headers with Modular Scale] Reference: - [Fluid Typography | CSS-Tricks - CSS-Tricks](https://css-tricks.com/snippets/css/fluid-typography/) - [Complete Guide To Fluid Typography With CSS Clamp](https://www.lambdatest.com
$small-ratio: 1.2; // mobile
$large-ratio: 1.5; // desktop
h1 {
$small: $small-ratio * $small-ratio * $small-ratio * $small-ratio * 1rem;
$large: $large-ratio * $large-ratio * $large-ratio * $large-ratio * 1rem;
font-size: fluid($small, $large);
}
h2 {
@feroze-m
feroze-m / Let's Encrypt + Certbot -- Quickread
Last active August 6, 2023 05:04
Let’s Encrypt + Certbot
Some findings related to usage of Let's Encrypt and Certbot:
- Certs are valid for 90 days.
- Can be generated with cli with challenges like DNS (TXT Records), HTTP (/.well-known/acme-challenge/<TOKEN>)
- Wildcard certs can be generated with DNS challenge, but for auto-renew to work with this wildcard, DNS provider must have a certbot DNS plugin.
- Refer: https://eff-certbot.readthedocs.io/en/stable/using.html#dns-plugins
- Docker images: https://hub.docker.com/u/certbot
- Example.com using godaddy dns plugin (Not official - https://github.com/miigotu/certbot-dns-godaddy)
@extratone
extratone / draftsredirection.md
Last active June 25, 2024 06:53
Index of davidblue.wtf redirects.
@meg-gutshall
meg-gutshall / .asdfrc
Last active November 18, 2022 21:19
Config Files
legacy_version_file = yes
@Treast
Treast / _fonts.scss
Created November 26, 2021 08:40
WordPress snippets
$fontPath: '../../fonts';
@mixin fonts($name, $file, $fontWeight) {
@font-face {
font-family: $name;
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot');
src: url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.eot?#iefix') format('embedded-opentype'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff2') format('woff2'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.woff') format('woff'),
url('#{$fontPath}/#{to-lower-case(#{$name})}/#{$file}.ttf') format('truetype'),
@mike-at-redspace
mike-at-redspace / custom-post-type.php
Created June 24, 2021 09:50
Register Custom Post Type
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@abelsaad
abelsaad / functions.php
Created May 19, 2021 23:09
Content Excerpt Limit
<?php
function excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
@hmowais
hmowais / functions.php
Last active February 11, 2023 18:59
Google Page Speed [Manual-Updated]
<?php
/* cleaup*/
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // prev link