Skip to content

Instantly share code, notes, and snippets.

View samediamba's full-sized avatar

Samedi S. Amba samediamba

View GitHub Profile
@samediamba
samediamba / Genesis Related Posts
Last active August 29, 2015 14:14
Related Posts for the Genesis Framework
@samediamba
samediamba / Change WP title description
Last active August 29, 2015 14:15
Change "Enter Title Here" for custom post types
/*
Add the following to the functions/functionality file
Courtesy: http://lizardpc.com/blog/how-to/change-enter-title-here-for-custom-post-types-wordpress-3-8/
*/
function title_text_input ( $title ) {
if ( get_post_type() == 'name_of_your_custom_post_type' ) {
$title = __( 'Enter your whatever text you want' );
}
return $title;
@samediamba
samediamba / Change Excerpt Text
Created February 12, 2015 08:41
Change text in post excerpt metabox
/**
* Change the Excerpt text and description
*/
function change_excerpt_name( $translated_text, $text, $domain ) {
if ( $_GET['post_type'] == 'staff' ) {
switch ( $translated_text ) {
case 'Excerpt' :
$translated_text = 'Staff Role/Position';
break;
case 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="http://codex.wordpress.org/Excerpt" target="_blank">Learn more about manual excerpts.</a>' :
@samediamba
samediamba / Custom Image Upload box for CPT
Created February 12, 2015 09:28
Change the Featured Image Box and upload link Labels for Custom Post Type
/**
* Change the Featured Image Box and upload link Labels for Custom Post Type
* @link https://wordpress.org/support/topic/relabel-featured-image-on-custom-type
*/
/*This section changes the label of the image box*/
add_action('do_meta_boxes', 'change_image_box');
function change_image_box()
{
remove_meta_box( 'postimagediv', 'staff', 'side' ); /*Alter the word "Staff" to match the name of your CPT */
@samediamba
samediamba / related-staff.php
Last active August 29, 2015 14:15
Sample Staff Page
@samediamba
samediamba / default-conditional-featured-image.php
Last active August 29, 2015 14:16
Default and Conditional Featured Image for WP
<?php
/**
* Custom Body Classes
* @link http://www.billerickson.net/wordpress-class-body-tag/
* @author Bill Erickson
*
* @param array $classes existing body classes
* @return array modified body classes
*/
<?php
/**
* Home Slider
*
* Uses the Genesis Responsive slider combined with Advanaced Custom Fields
* setting in Dashboard - Instellingen website
*/
function rrwd_home_slider() {
global $wpdb;
@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 / 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