Skip to content

Instantly share code, notes, and snippets.

View joecue's full-sized avatar
🎯
Focusing

Joe Querin joecue

🎯
Focusing
View GitHub Profile
@joecue
joecue / manage_paragraphs.php
Created November 14, 2019 16:14 — forked from Jany-M/manage_paragraphs.php
[WP][PHP] Split first paragraph from main content, display it elsewhere
<?php
// Grab the first paragraph, show it where you need it, then take the rest of the content and remove the first paragraph and show it elsewhere
// The script uses WordPress functions/content but can be used in any PHP script, just replace the WP functions
// First Paragraph
global $post;
$p1 = wpautop( $post->post_content );
$p1 = substr( $p1, 0, strpos( $p1, '</p>' ) + 4 );
//$p1 = strip_tags($p1, '<a><strong><em><h3><h2><i>'); // in case you need to remove some tags, add the ones you want to KEEP here
@joecue
joecue / functions.php
Created January 18, 2018 13:57 — forked from kierzniak/functions.php
Search across all network blogs in elasticpress
<?php
/**
* Search across all network blogs with elasticpress
*
* @param $scope string Search scope
*
* @return string
*/
function motivast_ep_search_scope( $scope ) {
@joecue
joecue / New_Calendar.php
Last active March 9, 2017 17:20
Cleaner Calendar PHP Script
<!DOCTYPE>
<html>
<head>
<style>
#calendar{
width: 336px;
display: inline-block;
background-color: #000;
border: 1px solid #000;
}
@joecue
joecue / slider.css
Created March 1, 2017 00:29
Web Design 1 Javascript Slider Code
#slider {
margin: 2em auto;
width: 960px;
overflow: hidden;
}
#slider-wrapper {
width: 9999px;
height: 300px;
position: relative;
@joecue
joecue / functions.php
Created July 24, 2016 01:32
Reset WordPress User Role Capabilities
if ( !function_exists( 'populate_roles' ) ) {
require_once( ABSPATH . 'wp-admin/includes/schema.php' );
}
populate_roles();
@joecue
joecue / gulp-modules.txt
Last active August 22, 2019 15:54
Copy a line below and then click on bash terminal window and press insert key.
npm install gulp --save-dev
npm install browser-sync --save-dev
npm install gulp-autoprefixer --save-dev
npm install gulp-changed --save-dev
npm install gulp-combine-media-queries --save-dev
npm install gulp-concat --save-dev
npm install gulp-debug --save-dev
npm install gulp-filter --save-dev
npm install gulp-header --save-dev
npm install gulp-newer --save-dev
@joecue
joecue / guest.html
Created June 10, 2016 15:51
JavaScript from MyCampus - Display Posts from WordPress Via WP REST API
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function($) {
$.getJSON("http://sites.lorainccc.edu/mylccc/wp-json/wp/v2/posts/?filter[category_name]=mycampus", function (data) {
$.each(data, function( index ){
@joecue
joecue / email-metabox.php
Created May 13, 2016 18:22
Custom WordPress Meta Box to Capture Date to select posts from.
<?php
/*
* Code adapted from https://www.smashingmagazine.com/2011/10/create-custom-post-meta-boxes-wordpress
* Created May 2016.
*
*/
/* Fire our meta box setup function on the post editor screen. */
add_action( 'load-post.php', 'lc_emailer_post_meta_boxes_setup' );
@joecue
joecue / gulpfile.js
Last active April 29, 2016 00:02
LCCC WD2 - Sample Gulp file, and package json file
var project = 'twentyfifteen_child',
parentTheme = 'twentyfifteen',
gulp = require('gulp'),
sass = require('gulp-sass'),
notify = require('gulp-notify'),
header = require('gulp-header'),
plumber = require('gulp-plumber');
gulp.task('sass', function () {
return gulp.src('./themes/' + project + '/scss/style.scss')
@joecue
joecue / plugin.php
Created March 16, 2016 12:54
WordPress - Theme file in Plugin
function my_event_template($single_template) {
global $post;
if ($post->post_type == 'event') {
return dirname( __FILE__ ) . '/single-event.php';
return $single_template;
}
add_filter( "single_template", "my_event_template" ) ;