Skip to content

Instantly share code, notes, and snippets.

View melissacabral's full-sized avatar

Melissa Cabral melissacabral

View GitHub Profile
<?php
/*
* Plugin Name: Media Upload Widget
* Plugin URI: http://wordpress.melissacabral.com
* Description: A widget that allows you to upload media from a widget
* Version: 1.0
* Author: Melissa Cabral
* Author URI: http://wordpress.melissacabral.com
* License: GPLv3
*/
@melissacabral
melissacabral / gist:02c89fa1bab0307dfd2e
Created January 6, 2016 19:03 — forked from engelen/gist:9df926bd9f3957394d89
Use WordPress dashicons in your theme on the frontend.
<?php
add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );
/**
* Enqueue Dashicons style for frontend use
*/
function mytheme_scripts() {
wp_enqueue_style( 'dashicons' );
}
@melissacabral
melissacabral / template-archive-per-term.php
Last active April 26, 2021 16:44
Wordpress template to show one post from each category/taxonomy term
<?php
/*
Template Name: Post thumbnails by taxonomy term
*/
//edit these to match the stuff you registered in your custom post type plugin
$post_type = 'work';
$taxonomy = 'work_category'; ?>
<?php get_header(); ?>
@melissacabral
melissacabral / wp-theme-customization-functions.php
Created February 9, 2015 18:27
theme customization addition for functions
<?php
/**
* Customization API
*/
//add_action( 'customize_register', 'awesome_theme_customizer' );
//
function awesome_theme_customizer( $wp_customize ) {
//Link color
//create the setting and its defaults
$wp_customize->add_setting( 'awesome_link_color', array( 'default' => '#6bcbca', ));
jQuery(function( $ ){
$("header .genesis-nav-menu").addClass("responsive-menu").before('<div id="responsive-menu-icon-header"></div>');
$(".nav-primary .genesis-nav-menu").addClass("responsive-menu").before('<div id="responsive-menu-icon-nav"></div>');
$("#responsive-menu-icon-header").click(function(){
$("header .genesis-nav-menu").slideToggle();
});
$("#responsive-menu-icon-nav").click(function(){
$(".nav-primary .genesis-nav-menu").slideToggle();
@charset "utf-8";
/* CSS Document */
#rad-slider {
position: relative;
list-style: none;
overflow: hidden;
width: 100%;
padding: 0;
margin: 0;
max-width:1120px;
<aside id="complementary">
<?php
//get the titles of the most popular (by number of comments) 5 published posts
$query_popular = 'SELECT posts.title, posts.post_id, COUNT(*) AS numcomments
FROM posts, comments
WHERE posts.is_published = 1
AND posts.post_id = comments.post_id
GROUP BY posts.post_id
ORDER BY numcomments DESC
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Pure CSS Dropdowns</title>
<link href="css/reset.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
@melissacabral
melissacabral / template-sitemap.php
Created June 18, 2013 18:00
easy automatic sitemap in wordpress page template
<?php
/*
Template Name: Automagic Sitemap
Will automatically generate a sitemap from the wordpress database of posts, pages, and categories.
*/
?>
<?php get_header(); ?>
<div id="content">
@melissacabral
melissacabral / awesome-style.css
Created June 17, 2013 15:59
awesome co style.css
/*
Theme Name: Awesome Co
Theme URI: http://melissacabral.com/
Description: A barebones theme for learning!
Author: melissa cabral
Author URI: http://melissacabral.com
Version: 1.0
License: GPLv2
License URI: license.txt