Skip to content

Instantly share code, notes, and snippets.

View celticwebdesign's full-sized avatar

Darren Stevens celticwebdesign

View GitHub Profile
$taxonomy = 'blog-category';
$terms = get_terms(
$taxonomy,
array(
'hide_empty' => 1,
'parent' => 0
)
);
// 'parent' => 0
if ($terms) {
<?php
$args = array(
'post_type' => 'notices-mariners',
'post_status' => 'publish',
'posts_per_page' => 2,
'meta_key' => 'mariners_date_selected',
'orderby' => 'meta_value_num',
'order' => 'ASC'
);
<?php
// If needed to get a specific category
// echo "<pre>";
// var_dump($wp_query->query_vars);
// echo "</pre>";
// echo $wp_query->query_vars['gallery-category'];
$args = array(
'post_type' => 'document',
@celticwebdesign
celticwebdesign / Dev Template Name
Last active April 18, 2017 16:42
Provides quick information for each WordPress page / post template.
// DEVELOPER
function dev_template_name() {
global $template, $post;
$template_array = explode('/',$template);
echo '
<style>
.dev-template-name {position:fixed;bottom:200px;right:10px;background: rgba(255,0,0,0.6);color:#fff;padding:2px 4px;font-size:0.8em;z-index: 100;/*display: none;*/}
</style>
HTML ----
<?php
// slideshow
$rows = get_field('slideshow_repeater');
if($rows) {
echo "<!-- slideshow -->
<div id='slideshow' class='full-width clearfix'>
@celticwebdesign
celticwebdesign / Bootstrap additional grid sizes
Last active January 6, 2016 10:14
Provides a smaller grid - 480px to 991px
/*
* Bootstrap additional grid sizes
*/
@media only screen and (min-width: 480px) and (max-width: 991px) {
.col-xxs-1, .col-xxs-2, .col-xxs-3, .col-xxs-4, .col-xxs-5, .col-xxs-6, .col-xxs-7, .col-xxs-8, .col-xxs-9, .col-xxs-10, .col-xxs-11, .col-xxs-12 {position: relative;min-height: 1px;padding-right: 15px;padding-left: 15px;float: left;}
.col-xxs-12 {width: 100%;}.col-xxs-11 {width: 91.66666667%;}.col-xxs-10 {width: 83.33333333%;}.col-xxs-9 {width: 75%;}.col-xxs-8 {width: 66.66666667%;}.col-xxs-7 {width: 58.33333333%;}.col-xxs-6 {width: 50%;}.col-xxs-5 {width: 41.66666667%;}.col-xxs-4 {width: 33.33333333%;}.col-xxs-3 {width: 25%;}.col-xxs-2 {width: 16.66666667%;}.col-xxs-1 {width: 8.33333333%;}
.col-xxs-pull-12 {right: 100%;}.col-xxs-pull-11 {right: 91.66666667%;}.col-xxs-pull-10 {right: 83.33333333%;}.col-xxs-pull-9 {right: 75%;}.col-xxs-pull-8 {right: 66.66666667%;}.col-xxs-pull-7 {right: 58.33333333%;}.col-xxs-pull-6 {right: 50%;}.col-xxs-pull-5 {right: 41.66666667%;}.col-xxs-pull-4 {right: 33.3333333
/* ------------------------------------
Gravity Forms Bootstrap
Help from https://gist.githubusercontent.com/DevinWalker/7110951/raw/8f6863c52df3cc0d627bb1e18e9cb832b5ecf395/gravity-forms_bootstrap
https://wordpress.org/plugins/gravity-forms-bootstrap-3-style/
---------------------------------------*/
.gform_wrapper ul{padding-left:0;list-style:none}.gform_wrapper li{margin-bottom:15px}.gform_wrapper form{margin-bottom:0}.gform_wrapper .gfield_required{padding-left:1px;color:#b94a48}.ginput_container input,.ginput_container select,.ginput_container textarea, #theme-my-login input{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.gin
@celticwebdesign
celticwebdesign / WordPress Pagination
Created August 26, 2015 16:16
Used on main archive page.
// functions.php
// Pagination for paged posts, Page 1, Page 2, Page 3, with Next and Previous Links, No plugin
function html5wp_pagination()
{
global $wp_query;
$big = 999999999;
echo paginate_links(array(
'base' => str_replace($big, '%#%', get_pagenum_link($big)),
'format' => '?paged=%#%',
@celticwebdesign
celticwebdesign / gist:0038f3a69e863492dbef
Created November 22, 2015 11:31
WordPress Title - CPT / WPML / Yoast SEO
<?php if(is_post_type_archive('service')):
if( ICL_LANGUAGE_CODE == "zh-hans" ) {
// $language = "chinese";
$page = 336;
} else {
// $language = "english";
$page = 95;
}
echo "<title>".get_post_meta($page, '_yoast_wpseo_title', true)."</title>";
elseif(is_post_type_archive('testimonial')):
@celticwebdesign
celticwebdesign / Gravity Forms Spinner
Last active June 1, 2016 23:15
Gravity Forms spinner
body img.gform_ajax_spinner {
/*display: none!important;*/
display: block;
margin: 10px 0 0 10px;
position: relative;
top:10px;
left:10px;
max-width: 16px;
}