Skip to content

Instantly share code, notes, and snippets.

View ccurtin's full-sized avatar
🤙
makka thangs

Christopher James Curtin ccurtin

🤙
makka thangs
View GitHub Profile
<?php
function pagination($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
@ccurtin
ccurtin / functions.php
Created November 28, 2014 06:04
:WORDPRESS: numeric pagination simple
<?php
// Numbered Pagination
function wp_pagination() {
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages
@ccurtin
ccurtin / :WORDPRESS: basic custom loop.php
Created November 28, 2014 06:12
:WORDPRESS: basic-custom-loop
<?php get_header(); ?>
<main role="main" class="container">
<!-- section -->
<div class="page-title-container">
<h1 class="page-title"><?php the_title(); ?></h1>
</div>
<div id="content-container">
@ccurtin
ccurtin / :WORDPRESS: keep logged in (pre-functions for dev only)
Created November 28, 2014 08:04
:WORDPRESS: keep logged in (pre-functions for dev only)
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_1_year' );
function keep_me_logged_in_for_1_year( $expirein ) {
return 31556926; // 1 year in seconds
}
@ccurtin
ccurtin / wordpress-auto-enqueue-scripts.php
Last active July 27, 2017 12:56
: WORDPRESS : auto-enque scripts
<!DOCTYPE html>
<html>
<head>
<title>Wordpress Auto-Enque Scripts</title>
<link rel="stylesheet" href="_project_files_/highlight/styles/monokai.css">
<script src="_project_files_/highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<?php include('_project_files_/markdown/parsedown.php'); ?>
<style>
body{font-size: 1.3em; }
@ccurtin
ccurtin / WORDPRESS pagination for static homepage.php
Last active October 7, 2016 18:00
WORDPRESS pagination for static homepage
<?php
// This is necessary for STATIC homepage.
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
?>
@ccurtin
ccurtin / element-view-header.css
Last active August 29, 2015 14:13
Use jQuery to detect if an element in screen or not then apply/remove classes that have transitions to animate elements.
.masthead {
background: none;
background: #FFF;
border-bottom: 3px solid #EEE;
-webkit-transition: all 0.3s ease;
-moz-transition: all 0.3s ease;
-ms-transition: all 0.3s ease;
-o-transition: all 0.3s ease;
transition: all 0.3s ease;
overflow: hidden;
@ccurtin
ccurtin / ACF-searchable-fields-for-Wordpress-YOAST-SEO.php
Last active March 23, 2023 02:33
ACF searchable custom fields for Wordpress for YOAST SEO
<?php
add_filter('wpseo_pre_analysis_post_content', 'add_custom_to_yoast');
function add_custom_to_yoast( $content ) {
global $post;
$pid = $post->ID;
$custom = get_post_custom($pid); //gets all custom fields in an arry of the current post/page
unset($custom['_yoast_wpseo_focuskw']); // Don't count the keyword in the Yoast field!
@ccurtin
ccurtin / .bash-profile color PS1 settings
Last active August 29, 2015 14:13
.bash-profile settings
export PS1='\e[1;32m\w\e[1;32m >'
export PS1="[\[\033[32m\]\w]\[\033[0m\]\$(__git_ps1)\n\[\033[1;36m\]\u\[\033[32m\]$ \[\033[0m\]"
==========================
@ccurtin
ccurtin / : WORDPRESS : custom action hook.php
Created January 18, 2015 00:37
:WORDPRESS: custom action hook
<?php
/*
*------------------------------
* CREATING A CUSTOM ACTION HOOK
*------------------------------
/*
1. Create a custom action hook to load functions into
----------------------------------------------------*/
function wp_after_html() {