Skip to content

Instantly share code, notes, and snippets.

View samediamba's full-sized avatar

Samedi S. Amba samediamba

View GitHub Profile
@samediamba
samediamba / wp-admin-select2.php
Created April 7, 2022 13:41 — forked from yanknudtskov/wp-admin-select2.php
Add select2 to all select fields in WordPress Admin
<?php
function enqueue_select2_jquery() {
wp_register_style( 'select2css', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.css', false, '1.0', 'all' );
wp_register_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.4.8/select2.js', array( 'jquery' ), '1.0', true );
wp_enqueue_style( 'select2css' );
wp_enqueue_script( 'select2' );
}
add_action( 'admin_enqueue_scripts', 'enqueue_select2_jquery' );
@samediamba
samediamba / add-wordpress-settings-page.php
Created March 24, 2022 10:47 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@samediamba
samediamba / functionality.php
Last active March 1, 2022 04:38 — forked from haizdesign/functions.php
Show featured images on post screen - Admin Dashboard
<?php
// show featured images in dashboard
add_image_size( 'haizdesign-admin-post-featured-image', 120, 120, false );
// Add the posts and pages columns filter. They both use the same function.
add_filter('manage_posts_columns', 'haizdesign_add_post_admin_thumbnail_column', 2);
add_filter('manage_pages_columns', 'haizdesign_add_post_admin_thumbnail_column', 2);
// Add the column
@samediamba
samediamba / Responsive Iframes
Created June 7, 2013 09:41
What I recently used to make responsive Iframes for my Google docs embed. This happened as I was doing the UEAB site.
/* RESPONSIVE IFRAME GIST
---------------------
Useful Links:
Responsive Embeds: http://amobil.se/2011/11/responsive-embeds/
Creating Intrinsic Ratios for Video: http://alistapart.com/article/creating-intrinsic-ratios-for-video */
/* STEP 1: Grab the Embed. Go to https://docs.google.com/viewer and paste in URL to the document. looks like below:*/
<iframe src="http://docs.google.com/viewer?url=ueab.ac.ke%2Fdownloads%2Ffinal-bulletin-2013.pdf&embedded=true" width="600" height="780" style="border: none;"></iframe>
@samediamba
samediamba / gist:65f0c554f3821fb221af98bb315c17fd
Created December 11, 2017 12:09 — forked from dopa/gist:5245868
Shell Script to Back Up all MySQL Databases, Keep 7 Days of Backups
#!/bin/bash
# Script will output dumps for all databases using seperate files
# Derived from this post: http://www.cyberciti.biz/faq/ubuntu-linux-mysql-nas-ftp-backup-script/
USER="root"
PASSWORD="SnM1073k"
HOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
OUTPUT_DIR="/backups/files"
@samediamba
samediamba / index.html
Created June 17, 2013 08:54
Responsive CSS Ribbon
<!-- RIBBON 1 -->
<div class="container one">
<div class="bk l">
<div class="arrow top"></div>
<div class="arrow bottom"></div>
</div>
<div class="skew l"></div>
/**Place in Functions.php
// move comment box above comments
remove_action('genesis_comment_form', 'genesis_do_comment_form');
add_action( 'genesis_before_comments', 'genesis_do_comment_form');
<?php
/*** Change default comment text in StudioPress Genesis Courtesy of WP Snacks: http://goo.gl/Dp8Lv**/
function change_default_comment_text($args) {
$args['title_reply'] = 'Have your Say';
return $args;
}
add_filter( 'genesis_comment_form_args', 'change_default_comment_text' );
?>
@samediamba
samediamba / Customize Genesis Post Meta Data
Created June 30, 2013 11:11
How to customize the Post Meta data section of a Genesis Child Theme.
<?php /*Add the code below to the genesis_before_post_content Hook */
<div class="post-info">
<span class="time">
<?php /*Code courtesy of WP Beginner: http://goo.gl/3512D and Studiopress: http://goo.gl/72Qbx*/ ?>
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "Last modified on ";
the_modified_time('F jS, Y');
@samediamba
samediamba / index.html
Created June 17, 2013 08:33
Creates an effect like that of the LOC book showcase. A CodePen by Jdias. Responsive grid & background slide -
<link href='http://fonts.googleapis.com/css?family=Lato:400,300' rel='stylesheet' type='text/css'>
<div id="wrapper">
<div id="list">
<div class="item" id="primeiro" style="height: 14em;">
<p class="titulo">Winterfell</p>
</div>
<div class="item" id="segundo" style="height: 26em;">
<p class="titulo">Jon Snow</p>
</div>