Skip to content

Instantly share code, notes, and snippets.

Ollie Treend ollietreend

Block or report user

Report or block ollietreend

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ollietreend / functions.php
Created Sep 4, 2017
Get a WordPress attachment ID given its URL
View functions.php
* Get attachment ID from its URL
* @param string $url
* @return bool|int The Attachment ID or false if not found
function get_attachment_id_from_src($url) {
if (($pos = strpos($url, '/uploads/')) === false) {
ollietreend / functions.php
Created Aug 16, 2017
WordPress admin bar bump for Bootstrap fixed navbar
View functions.php
namespace MyTheme;
function setup() {
add_theme_support('admin-bar', ['callback' => __NAMESPACE__ . '\\admin_bar_bump']);
add_action('after_setup_theme', __NAMESPACE__ . '\\setup');
ollietreend / acf-php-to-json.php
Last active Feb 14, 2020
Convert Advanced Custom Fields Pro configuration from PHP to JSON.
View acf-php-to-json.php
* Plugin Name: Convert ACF PHP to JSON
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON.
namespace ConvertAcfPhpToJson;
* Add submenu item under 'Custom Fields'
View image.php
* Disables the media attachment page by redirecting the user elsewhere.
* Save as 'image.php' in theme.
* Inspired by
if ($post->post_parent) {
wp_redirect(get_permalink($post->post_parent), 301);
} else {
ollietreend / .screenrc
Created Feb 26, 2015
.screenrc config
View .screenrc
# Tabs in status bar
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c %{g}]'
# Disable epilepsy triggers
vbell off
# Enable scrolling
termcapinfo xterm ti@:te@
You can’t perform that action at this time.